An interesting difference between classic and new style objects
Oren Tirosh
oren-py-l at hishome.net
Mon Jan 7 08:09:46 EST 2002
More information about the Python-list mailing list
Mon Jan 7 08:09:46 EST 2002
- Previous message (by thread): An interesting difference between classic and new style objects
- Next message (by thread): An interesting difference between classic and new style objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Jan 07, 2002 at 10:30:13AM +0100, Alex Martelli wrote: > However, PEP 252 also specifies: > """ > The introspection API is a read-only API. We don't define the > effect of assignment to any of the special attributes (__dict__, > __class__ and __bases__), nor the effect of assignment to the > items of a __dict__. Generally, such assignments should be > considered off-limits. A future PEP may define some semantics for > some such assignments. > """ > > As here we are indeed dealing with "assignment to [an item] of > a __dict__", we may be in the grey zone to "be considered > off-limits". Some clarification would surely be welcome. In this case __repr__ is not a special attribute. It is a user attribute with a well-known name that some builtin functions refer to. There are even examples of this happening for attributes without underscores. There is no use of the introspection API, either. I believe that assignment of attributes is well within the bounds of the basic language definition and yet it produces different results for classic and new style objects. Oren
- Previous message (by thread): An interesting difference between classic and new style objects
- Next message (by thread): An interesting difference between classic and new style objects
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list