Created
February 19, 2009 20:32
-
-
Save maio/67108 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User: | |
name = None | |
class Book: | |
title = None | |
owner = None | |
client = None | |
user1 = User() | |
user1.name = 'maio' | |
user2 = User() | |
user2.name = 'Idaho' | |
book1 = Book() | |
book1.title = 'Flotila' | |
book1.owner = user2 | |
book1.purchaser = user1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[maio@maio-vs ~(master)] $ python | |
Python 2.5.2 (r252:60911, Mar 9 2008, 03:52:30) | |
[GCC 4.3.0 20080301 (prerelease) [gcc-4_3-branch revision 132801]] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> class User: | |
... name = None | |
... | |
>>> | |
>>> class Book: | |
... title = None | |
... owner = None | |
... client = None | |
... | |
>>> | |
>>> user1 = User() | |
>>> user1.name = 'maio' | |
>>> | |
>>> user2 = User() | |
>>> user2.name = 'Idaho' | |
>>> | |
>>> book1 = Book() | |
>>> book1.title = 'Flotila' | |
>>> book1.owner = user2 | |
>>> book1.purchaser = user1 | |
>>> | |
>>> | |
>>> book1.title | |
'Flotila' | |
>>> book1.title = 'XXX' | |
>>> book1.title | |
'XXX' | |
>>> book1.owner | |
<__main__.User instance at 0x40219dac> | |
>>> book1.owner.name | |
'Idaho' | |
>>> book1.purchaser.name | |
'maio' | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment