At Wednesday 8/11/2006 16:51, Peter van Kampen wrote:
"""
A = B = [] # both names will point to the same list
"""
I've been bitten by this once or twice in the past, but I have always
wondered what it was useful for? Can anybody enlighten me?
As an optimization, inside a method, you can bind an instance
attribute and a local name to the same object:
def some_action(self):
self.items = items = []
// following many references to self.items,
// but using items instead.
Names in the local namespace are resolved at compile time, so using
items is a lot faster than looking for "items" inside self's
namespace each time it's used.
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
--
http://mail.python.org/mailman/listinfo/python-list