A weird thing (I think)

a guest Aug 11th, 2018 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class c:
  2.     def __init__(self):
  3.         # don't create any attributes of 'self', that will cause an error if tried to evaluate that variable
  4.         self = self() # the weirdest part
  6.     # this function doesn't need 'self', because of 'self = self()' (idk why). It can be accessed by 'c.test()'
  7.     def test():
  8.         print ('test')
  10.     # this variable can be accessed by 'c.spam'
  11.     spam = 'eggs'
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand