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

Cata catalinfest at gmail.com
Sun Apr 4 11:02:13 CEST 2010


So is not possible to testing if a variable is defined with this functions
vars(), globals(), locals() ?
Or maybe i make confusion with another issue.
Please more specific ... Thank you

2010/4/4 Chris Rebert <clp2 at rebertia.com>

> On Sun, Apr 4, 2010 at 1:42 AM, catalinfest at gmail.com
> <catalinfest at gmail.com> wrote:
> > Hi everyone .
> > My questions is "why vars().has_key('b') is False ?'
> > I expecting to see "True" because is a variable ...
>
> The built-in constants and functions aren't global variables, they're
> in the special __builtins__ dictionary/namespace, and thus not part of
> globals() or vars().
>
> Cheers,
> Chris
> --
> http://blog.rebertia.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100404/44cc1c13/attachment.html>


More information about the Python-list mailing list