instance references?
Scott David Daniels
scott.daniels at acm.org
Tue Jan 31 19:37:46 EST 2006
Scott David Daniels wrote:
> Alex Martelli wrote: (in effect)
>> aptbase.drawables = weakref.WeakValueDictionary()
>> then in each __init__
>> aptbase.drawables[len(aptbase.drawables)] = self
>> then in show:
>> for o in aptbase.drawables.values():
>> # render it
>
> The keys you are choosing are probably not a good idea.
> Problem demo:
> a,b,c = Something(), Something(), Something()
> b = None
> d = Something() # overwrites the d entry.
In a tiny demo of what exactly the problem is, I managed to
mess up the comment.
a, b, c = Something(), Something(), Something()
b = None
d = Something() # overwrites the _c_ entry.
Silly me.
--Scott David Daniels
scott.daniels at acm.org
More information about the Python-list
mailing list