Steven D'Aprano wrote: > On Tue, 22 Aug 2006 10:12:00 -0700, BartlebyScrivener wrote: > >>>> how difficult would it be to assign a string name(s) >>>> to an object upon creation (and upon referencing)? >> >> Exactly the point that's being made. It's so easy just do it yourself: >> >> banana={"name":"banana"} >> >> Hey what is the name of my dictionary? >> >> banana["name"] >> >> But why build it into Python and force everyone else to do it, when >> most of the time nobody cares what the name is, or they already know? >> >> It's like forcing everybody everywhere always and forever to wear >> "Hello My Name Is" tags. > > On reflection, I'm wondering if we've been too harsh on Jojoba and not > thought this through, simply because "that's the way it's always been". > > Functions have a __name__ attribute. So do classes and modules. Why are > these three objects "special" that they know the name they were created > with, when other objects don't? Python doesn't attempt to track what name > they are known at *now*, just the name they were born with.
Because they're not created by simple assignment, because they are usually created once, because new names are bound to them rarely, and because it's crucial to know their name in debugging, introspection etc. Georg -- http://mail.python.org/mailman/listinfo/python-list