Here is an idea that might help - you do have some control over
assignment to attributes of an object. If you stored your objects in
another object you could assign __name__ attributes automatically. For
example:
class Container(object):
def __setattr__(self, name, value):
if not hasattr(value, '__name__'):
try:
value.__name__ = name
except:
pass
object.__setattr__(self, name, value)
class Item(object):
pass
c = Container()
c.s = 'string'
c.i = Item()
print c.i.__name__ # i
print c.s.__name__ # AttributeError, can't add __name__ attribute to string
Kent
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor