unbinding a global variable in Python

Duncan Booth duncan.booth at invalid.invalid
Thu Apr 30 14:01:13 CEST 2009


Mark Tarver <dr.mtarver at ukonline.co.uk> wrote:

> Great; and how can I test to see if a global is bound?
> 
> e.g Lisp
> 
>> (setq *g* 0)
> 0
> 
>> (boundp '*g*)
> t

By trying to access it and catching the NameError exception if it isn't 
defined.


-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list