Guido van Rossum wrote:
On 9/28/05, Jim Fulton [EMAIL PROTECTED] wrote:
...
I think we need to be real careful with chosing a name -- in Jim's
example, *anyone* could assign to Spam().eggs to override the value.
The name readproperty is too close to readonlyproperty,
In fact, property
On 9/28/05, Jim Fulton [EMAIL PROTECTED] wrote:
Read descriptors (defining only __get__) and data descripttors have
(defining __get__ and __set__) different semantics. In particular,
read descriptors are overridden by instance data, while data
descriptors are not. A common use of read
At 10:16 AM 9/28/2005 -0400, Jim Fulton wrote:
I do this often enough that I think it would be useful to include it
in python, either as a builtin (like property) or in the library. (Or
possibly by adding an option to property to generate a read
descriptor.) I'd be happy to add this for 2.5.
Phillip J. Eby [EMAIL PROTECTED] writes:
Unfortunately, finding out a descriptor's name is non-trivial; it'd be nice
if there were a descriptor hook __bind__(cls,name) that was called by
classes during cls.__new__ or assignment to a class attribute, and which
you could define to return a
Michael Hudson mwh at python.net writes:
Phillip J. Eby pje at telecommunity.com writes:
Unfortunately, finding out a descriptor's name is non-trivial; it'd be nice
if there were a descriptor hook __bind__(cls,name) that was called by
classes during cls.__new__ or assignment to a
On Wed, Sep 28, 2005 at 10:16:12AM -0400, Jim Fulton wrote:
class readproperty(object):
[skip]
I do this often enough
I use it since about 2000 often enough under the name CachedAttribute:
http://cvs.sourceforge.net/viewcvs.py/ppa/qps/qUtils.py
(The current maintainer of the code is
At 05:28 PM 9/28/2005 +, iga Seilnacht wrote:
You can use something like this to find a descriptor's name:
snip
The given code fails if the same property appears under more than one name
or is used in more than one class. It also requires the property object to
be mutable, and is
On Wed, 2005-09-28 at 10:16, Jim Fulton wrote:
When we ask for the eggs attribute the first time, we call the
descriptor, which calls the eggs function. The function sets the eggs
attribute, overriding the descriptor. The next time the eggs attribute
is accessed, the saved value will be used
It doesn't work that way for new-style classes.
On 9/28/05, Barry Warsaw [EMAIL PROTECTED] wrote:
On Wed, 2005-09-28 at 10:16, Jim Fulton wrote:
When we ask for the eggs attribute the first time, we call the
descriptor, which calls the eggs function. The function sets the eggs
attribute,
At 06:23 PM 9/28/2005 -0400, Barry Warsaw wrote:
I /must/ be missing something. Why not just use property as a
decorator?
class C:
@property
def eggs(self):
print 'in eggs'
self.eggs = 7
return self.eggs
c = C()
c.eggs
in eggs
7
c.eggs
7
Because it
On Wed, 2005-09-28 at 19:14, Phillip J. Eby wrote:
Because it only works in classic classes due to a bug in descriptor handling:
Blah. ;)
-Barry
signature.asc
Description: This is a digitally signed message part
___
Python-Dev mailing list
11 matches
Mail list logo