Bugs item #1419989, was opened at 2006-01-31 08:08 Message generated for change (Comment added) made by birkenfeld You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1419989&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: Python 2.4 >Status: Closed >Resolution: Wont Fix Priority: 5 Submitted By: Shaun Cutts (shauncutts) Assigned to: Nobody/Anonymous (nobody) Summary: class dictionary shortcircuits __getattr__ Initial Comment: page 3.3.2 of Language Reference states: "....Note that at least for instance variables, you can fake total control by not inserting any values in the instance attribute dictionary (but instead inserting them in another object)." A counterexample (doctest style): ----------------------------- >>> class Foo: ... bar = None ... def __getattr__( self, attr ): ... return 'boo' ... >>> f = Foo() >>> print "bar: ",f.bar bar: None ------------------------------ 'bar' in class dictionary (not just in instance dictionary) also causes __getattr__ not to be called. BTW.. above in the doc, it says that __getattr__ called only if "normal methods" can't find attribute. So this would seem a documentation bug. However, right now at least, I would prefer if the instance dictionary alone were decisive. ---------------------------------------------------------------------- >Comment By: Georg Brandl (birkenfeld) Date: 2006-02-17 13:16 Message: Logged In: YES user_id=1188172 This is correct behavior as documented. The first sentence in the cited page is: """ [__getattr__ is] Called when an attribute lookup has not found the attribute in the usual places (i.e. it is not an instance attribute nor is it found in the class tree for self).""" """Note that **at least** for instance variables,""" explicitly tells you that you can't do anything about class variables. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1419989&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com