class Foo pass foo Foo def spam return spam foo __main__ Foo instance

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
[~]|3> class Foo:
|.> pass
|.>
[~]|4> foo = Foo()
[~]|5> def spam(): return 'spam'
|.>
[~]|6> foo
<6> <__main__.Foo instance at 0x836da2c>
[~]|7> foo.spam = spam
[~]|8> foo.spam()
<8> 'spam'