vars().has_key() question about how working .

catalinfest at gmail.com catalinfest at gmail.com
Sun Apr 4 10:42:19 CEST 2010


Hi everyone .
My questions is "why vars().has_key('b') is False ?'
I expecting to see "True" because is a variable ...
Thanks
Please see code bellow .
>>> x=11
>>> def something():
...     b=25
...
>>> vars().has_key('x')
True
>>> vars().has_key('b')
False
>>> globals().has_key('x')
True
>>> globals().has_key('b')
False
>>>



More information about the Python-list mailing list