[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: built-in 'property'
From: Steven Bethard <steven.bethard () gmail ! com>
Date: 2004-12-28 18:14:24
Message-ID: 4ohAd.33566$k25.1120 () attbi_s53
[Download RAW message or body]
Steven Bethard wrote:
> I seem to be missing some of the messages on this thread, but while
> we're talking about properties, it's probably instructive to remind
> people that the functions passed to the property function are not
> redefinable in subclasses:
>
> py> class D(C):
> ... def getx(self):
> ... return 42
> ...
> py> D(5).x
> 5
Oops, sorry! Bad copy-paste! No biscuit! Ignore the code above here.
Important code is below:
> py> class C(object):
> ... def getx(self):
> ... return 1
> ... x = property(getx)
> ...
> py> class D(C):
> ... def getx(self):
> ... return 42
> ...
> py> C().x
> 1
> py> D().x
> 1
Steve
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic