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!
- class c:
- def __init__(self):
- # don't create any attributes of 'self', that will cause an error if tried to evaluate that variable
- self = self() # the weirdest part
- # this function doesn't need 'self', because of 'self = self()' (idk why). It can be accessed by 'c.test()'
- def test():
- print ('test')
- # this variable can be accessed by 'c.spam'
- spam = 'eggs'
RAW Paste Data