>>>>> David <[email protected]> (D) wrote:

>D> Il Sat, 17 Oct 2009 23:43:36 -0700 (PDT), StarWing ha scritto:
>>> I got a idea, use a try...except statement. there are another way to
>>> do it ?
>>> 
>>> (I just curious now, because I solve my problem in another way :-)

>D> locals().has_key(myname) 
>D> globals().has_key(myname)

1. This excludes builtins. The OP says: `no matter where is it', so that
   suggests also builins.
2. The more modern invocation would be "myname in locals()" or "myname
   in globals()". In Python3 the other one isn't supported anymore.
-- 
Piet van Oostrum <[email protected]>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to