On Sat, Oct 17, 2009 at 11:43 PM, StarWing <weasley...@sina.com> wrote: > On 10月18日, 下午2时37分, Chris Rebert <c...@rebertia.com> wrote: >> On Sat, Oct 17, 2009 at 11:30 PM, StarWing <weasley...@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. > > Okay... Thank you... But if I want to do that, what shall I do? > > 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 :-)
Perhaps if you could explain why there's the possibility these variables might not be defined... Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list