[Numpy-discussion] (no subject)

Alexandre Fayolle alexandre.fayolle at logilab.fr
Wed Jul 5 10:49:58 CDT 2006


On Wed, Jul 05, 2006 at 02:51:36PM +0200, ferenc pintye wrote:
> Hi,
> 
> how could i get the name of an array in a string ?

if by this you mean "the name of an identifier refering to [whatever]",
this is a FAQ, and the answer is

1. you don't want to do that
2. your problem is not well behaved (there can be many answers to the
questions)
3. you can use something along the lines of

for name, item in locals().iteritems():
    if item is my_array:
        break
else:
    name = "anonymous object"

-- 
Alexandre Fayolle                              LOGILAB, Paris (France)
Formations Python, Zope, Plone, Debian:  http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
Informatique scientifique:               http://www.logilab.fr/science
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 481 bytes
Desc: Digital signature
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060705/c822b88f/attachment-0001.bin 


More information about the Numpy-discussion mailing list