[ python-Bugs-1256010 ] bug in use of __getattribute__ ?
SourceForge.net
noreply at sourceforge.net
Wed Aug 10 19:04:35 CEST 2005
Bugs item #1256010, was opened at 2005-08-10 18:29
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1256010&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: Python Interpreter Core
Group: None
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: sylvain ferriol (ninou)
Assigned to: Nobody/Anonymous (nobody)
Summary: bug in use of __getattribute__ ?
Initial Comment:
hello, why it do not work:
class xx(object):
def __getattribute__(self,name):
tab = object.__getattribute__(self,'tab')
return tab[name]
def f(self,a):
self.a=a
x=xx()
xx.tab={'f':xx.f}
x.f(3)
unbound method f() must be called with xx instance as
first argument (got int instance instead)
----------------------------------------------------------------------
>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-08-10 19:04
Message:
Logged In: YES
user_id=1188172
This is not a bug. x.f results (via getattribute) in xx.f,
which is an "unbound method" (a method of a class that does
not belong to a specific instance) and as such has no
knowledge of your instance "x".
Please post first comp.lang.python in the future, as such
things are almost always a programmer's mistake.
Closing as Invalid.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1256010&group_id=5470
More information about the Python-bugs-list
mailing list