Is vars() meant to include globals?

Alex Martelli aleaxit at
Sat Sep 16 09:34:38 CEST 2000

"Opinderjit" <bhellao at> wrote in message
news:8pur74$jfb$1 at
> Where does the "classvar" variable go? It doesn't seem to be contained
> in vars(), locals() or globals().
> > class SomeClass:
> >     classvar = 3

Remember that vars() takes an argument -- the object whose variables
you want!  Here, you want the variables of the class object:

>>> class SomeClass:
 classvar = 3

>>> vars(SomeClass)
{'classvar': 3, '__module__': '__main__', '__doc__': None}


More information about the Python-list mailing list