Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 380bad1

Browse files
committed
Add note about __getattribute__.
1 parent e0b2d7a commit 380bad1

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ Core
1919
constructor, with the same signature as the builtin open() function.
2020
file() is now the preferred way to open a file.
2121

22+
- In 2.2a3, *for new-style classes only*, __getattr__ was called for
23+
every attribute access. This was confusing because it differed
24+
significantly from the behavior of classic classes, where it was
25+
only called for missing attributes. Now, __getattr__ is called only
26+
if regular attribute access raises AttributeError; to catch *all*
27+
attribute access, *for new-style classes only*, you can use
28+
__getattribute__. If both are defined, __getattribute__ is called
29+
first, and if it raises AttributeError, __getattr__ is called.
30+
2231
- In 2.2a3, __new__ would only see sequential arguments passed to the
2332
type in a constructor call; __init__ would see both sequential and
2433
positional arguments. This made no sense whatsoever any more, so

0 commit comments

Comments
 (0)