Re: getting an object name

2005-06-22 Thread Ron Adam
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) > Using an object's name as data isn't a good idea because it will g

Re: getting an object name

2005-06-22 Thread TZOTZIOY
On Wed, 22 Jun 2005 09:00:23 +0100, rumours say that Simon Brunning <[EMAIL PROTECTED]> might have written: >> Let's say I have a list called, alist. If I pass alist to a function, >> how can I get the name of it? > >The effbot put it beautifully: And IMO it should be in the FAQ: (http://www.pyth

Re: getting an object name

2005-06-22 Thread Simon Brunning
On 6/22/05, David Bear <[EMAIL PROTECTED]> 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? The effbot put it beautifully: "The same way as you get the name of that cat you found on your porch: the cat (object) itself cannot tell you i

Re: getting an object name

2005-06-22 Thread Irmen de Jong
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 n

Re: getting an object name

2005-06-21 Thread Robert Kern
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) In general, you don't. A particular object can have any number of name

getting an object name

2005-06-21 Thread David Bear
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) -- http://mail.python.org/mailman/listinfo/python-list