update from Atlas with major reorg

This commit is contained in:
Luciano Ramalho
2015-04-17 21:29:30 -03:00
parent 57902d31b5
commit a786180239
134 changed files with 369 additions and 520 deletions

View File

@@ -0,0 +1,29 @@
"""
Alex Martelli, _Python in a Nutshell, 2e._ (O'Reilly, 2006), p. 101
==========================
Properties and inheritance
==========================
Properties are inherited normally, just like any other attribute.
However, theres a little trap for the unwary: the methods called
upon to access a property are those that are defined in the class
in which the property itself is defined, without intrinsic use of
further overriding that may happen in subclasses. For example:
"""
class B(object):
def f(self):
return 23
g = property(f)
class C(B):
def f(self):
return 42
c = C()
print(c.g) # prints 23, not 42