fork download
  1. class Test():
  2. x = 'x in self'
  3. def do_stuff(self):
  4. x = 'just your general x'
  5. print(x)
  6. print(self.x)
  7. #print(do_stuff) #not defined
  8. print(self.do_stuff)
  9.  
  10.  
  11. t = Test()
  12. t.do_stuff()
  13.  
Success #stdin #stdout 0.02s 9984KB
stdin
Standard input is empty
stdout
just your general x
x in self
<bound method Test.do_stuff of <__main__.Test object at 0xb740e92c>>