Advertisement
Guest User

A weird thing (I think)

a guest
Aug 11th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.40 KB | None | 0 0
  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
  5.  
  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')
  9.  
  10.     # this variable can be accessed by 'c.spam'
  11.     spam = 'eggs'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement