From: Alexandre F. <ale...@lo...> - 2006-07-05 15:49:35
|
On Wed, Jul 05, 2006 at 02:51:36PM +0200, ferenc pintye wrote: > Hi, >=20 > 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 =3D "anonymous object" --=20 Alexandre Fayolle LOGILAB, Paris (France) Formations Python, Zope, Plone, Debian: http://www.logilab.fr/formations D=E9veloppement logiciel sur mesure: http://www.logilab.fr/services Informatique scientifique: http://www.logilab.fr/science |