list active variables

Aahz aahz at pythoncraft.com
Fri May 1 01:27:23 CEST 2009


In article <pan.2009.04.30.00.13.01 at REMOVE.THIS.cybersource.com.au>,
Steven D'Aprano  <steven at REMOVE.THIS.cybersource.com.au> wrote:
>On Wed, 29 Apr 2009 12:25:46 -0700, Iamanalien wrote:
>> 
>> how can i list all the variables that i am using?
>
>You can't.
>
>What you can do though is list all the available names that Python knows 
>about, whether you are using them or not, by using the dir() or vars() 
>functions.

You can also get a complete list of Python container objects with
gc.get_objects(); however, that does not show you strings and ints that
aren't in container objects.  Still, that gets you most of it.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"If you think it's expensive to hire a professional to do the job, wait
until you hire an amateur."  --Red Adair



More information about the Python-list mailing list