[Python-checkins] CVS: python/dist/src/Misc NEWS,1.249,1.250

Guido van Rossum gvanrossum@users.sourceforge.net
2001年9月22日 10:10:46 -0700


Update of /cvsroot/python/python/dist/src/Misc
In directory usw-pr-cvs1:/tmp/cvs-serv13012
Modified Files:
	NEWS 
Log Message:
Add note about __getattribute__.
Index: NEWS
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v
retrieving revision 1.249
retrieving revision 1.250
diff -C2 -d -r1.249 -r1.250
*** NEWS	2001年09月22日 04:44:21	1.249
--- NEWS	2001年09月22日 17:10:44	1.250
***************
*** 20,23 ****
--- 20,32 ----
 file() is now the preferred way to open a file.
 
+ - In 2.2a3, *for new-style classes only*, __getattr__ was called for
+ every attribute access. This was confusing because it differed
+ significantly from the behavior of classic classes, where it was
+ only called for missing attributes. Now, __getattr__ is called only
+ if regular attribute access raises AttributeError; to catch *all*
+ attribute access, *for new-style classes only*, you can use
+ __getattribute__. If both are defined, __getattribute__ is called
+ first, and if it raises AttributeError, __getattr__ is called.
+ 
 - In 2.2a3, __new__ would only see sequential arguments passed to the
 type in a constructor call; __init__ would see both sequential and

AltStyle によって変換されたページ (->オリジナル) /