How to get the 'name' of an int
Hans Brand
Hans.Brand at BrandInnovators.com
Fri Feb 28 04:56:54 EST 2003
"Just" <just at xs4all.nl> wrote in message
news:just-779694.10462828022003 at news1.news.xs4all.nl...
> In article <b3najo$hej$1 at reader08.wxs.nl>,
> "Hans Brand" <Hans.Brand at BrandInnovators.com> wrote:
>
> > Hi,
> >
> > I would like to get the 'name' of a variable to do something like this:
> >
> > causea = 12
> > causeb = 13
> > for cause in (causea, causeb):
> > print "%s = %s" %(name(cause), cause)
> >
> > The result should be:
> > causea = 12
> > causeb = 13
> >
> > How can I achieve this?
>
> You can't and you don't...
>
Thanks, I will stop trying ;-)
> Objects don't know to which name(s) they're
> bound to. Imagine this:
>
> causea = 12
> causeb = 13
> causec = causea
>
> You need to "reset your brain":
> http://effbot.org/guides/python-objects.htm
>
> HTH,
>
> Just
More information about the Python-list
mailing list