[Python-Dev] Duck-typing self
Sebastian Rittau
srittau at jroger.in-berlin.de
Sat Feb 28 00:57:20 CET 2009
On Wed, Feb 18, 2009 at 11:32:09PM +0100, Sebastian Rittau wrote:
> I am curious why the following will not work in Python:
>
> class foo(object):
> def bar(self):
> print self.attr
>
> class duck(object):
> attr = 3.14
>
> foo.bar(duck())
Thanks to everybody who has responded on-list or in private. Actually
Guido blogged about this design decision (among other things) in his
latest post to the "The History of Python" blog:
<http://tinyurl.com/c6qya5>.
- Sebastian
More information about the Python-Dev
mailing list