how do you get the name of a dictionary?
Georg Brandl
g.brandl-nospam at gmx.net
Wed Aug 23 12:44:35 EDT 2006
jojoba wrote:
>> And what im saying is that isnt it silly that we need pass an entire
>> namespace, when a much simpler notion would be to have each object know
>> its own name(s) (even if that name doesnt exist).
>
>
> please note: in my above comment, i was completely disregarding any
> notions of added costs that would be incurred to have such a feature,
> and that in fact, such costs might actually nullify any other benefits
> from having such a feature. Purely a what-if idea from a nascent python
> programmer.
Even from such a point of view, the concept isn't clearly enough defined.
What name would be assigned to the dict below?
l = [1,2,3]
a = "some_str"
l[0] = {'foo': 'bar'}
Some immutable objects, such as small integers, exist only once. Would you
assign names to them? They're likely to be completely meaningless.
When a name goes out of scope, but the object continues to live (e.g.
because it's returned by some function), the name is void.
Etc.
Georg
More information about the Python-list
mailing list