How to check the exists of a name?

Chris Rebert clp2 at rebertia.com
Sun Oct 18 02:37:55 EDT 2009


On Sat, Oct 17, 2009 at 11:30 PM, StarWing <weasley_wx at sina.com> wrote:
> Sometimes I want to make a simple flags. and i need to check there is
> a name in current scope or not (that is, we can visit this name, no
> matter where is it). and how to do that in python?

You should avoid needing to do that in the first place. Common
alternatives include using a dict instead of variables, depending on
your circumstances.

Cheers,
Chris
--
http://blog.rebertia.com



More information about the Python-list mailing list