~yacinechaouche/+junk/BZR

« back to all changes in this revision

Viewing changes to CODE/TEST/PYTHON/city.py

  • Committer: yacinechaouche at yahoo
  • Date: 2015-01-14 22:23:03 UTC
  • Revision ID: yacinechaouche@yahoo.com-20150114222303-6gbtqqxii717vyka
Ajout de CODE et PROD. Il faudra ensuite ajouter ce qu'il y avait dan TMP

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
class Region:
 
2
    def __init__(self,name,country):
 
3
        self.name = name
 
4
        self.country = country
 
5
 
 
6
class City:
 
7
    def __init__(self,name,region):
 
8
        self.region = region
 
9
        self.name = name
 
10
        
 
11
    def __getattr__(self,attr):
 
12
        return getattr(self.region,attr)
 
13
 
 
14
ontario = Region("Ontario","Canada")
 
15
otawa   = City("Otawa",ontario)
 
16
print otawa.name
 
17
print otawa.country
 
18