[Python-bugs-list] [ python-Bugs-615131 ] No attributes in nested functions
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 26 Sep 2002 11:58:08 -0700
Bugs item #615131, was opened at 2002-09-26 20:58
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=615131&group_id=5470
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jesús Cea Avión (jcea)
Assigned to: Nobody/Anonymous (nobody)
Summary: No attributes in nested functions
Initial Comment:
Python 2.2.1
I need this feature to keep a singleton inside and
local to a particular class method, for example.
This works fine:
>>> def a() :
... pass
...
>>> a.abc=23
>>> print a
<function a at 0x141500>
>>> print a.abc
23
>>>
This DOESN'T WORK:
>>> class a :
... def perico(self) :
... pass
...
>>> b=a()
>>> b.perico.abc=23
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'instance method' object has no
attribute 'abc'
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=615131&group_id=5470