problem with weakref.proxy
Walter Haslbeck
news at badblocks.de
Sat Jan 31 14:08:31 EST 2004
Peter Otten <__peter__ at web.de> wrote:
> I'd recommend being lazy and using a WeakValueDictionary instead of building
> the machinery on your own. Your code would then look similar to the
> following:
thanks for the tip, but:
[...]
> def c_show_all():
> print "all GObs, sorted by priority:"
> values = GOb.all.values()
> values.sort()
[...]
I don't want the list to be sorted in the method c_show_all, but when a
new instance is created. Sort a list is an expensive operation, and
c_show_all will be called on every game frame, but new objects are
created much less.
Walter
More information about the Python-list
mailing list