getting an object name
Irmen de Jong
irmen.NOSPAM at xs4all.nl
Wed Jun 22 03:12:47 EDT 2005
David Bear wrote:
> Let's say I have a list called, alist. If I pass alist to a function,
> how can I get the name of it?
>
> alist = range(10)
>
> def afunction(list):
> listName = list.__name__ (fails for a list object)
>
You don't, see the other reply.
You didn't say why you think you need this for, but I suspect
that you can solve your case by using a dict in one way or another:
{ "somename": [1,2,3,4,5] }
--Irmen
More information about the Python-list
mailing list