How to know when a variable is set

- madsurfer2000 at hotmail.com
Sat Nov 17 21:34:16 CET 2001


Michael Hudson <mwh at python.net> wrote in message news:<uvggdl5ek.fsf at python.net>...
> madsurfer2000 at hotmail.com (-) writes:
> 
> > How can I test if a variable has been given a value, or if it's undefined?
> 
> Why would you want to do that?  Specificaly, in what context do you
> want to know?
> 

I like the idea of structs, and I was planning to use a class the same
way, like

class info:
    pass
...
info.name = ... 

These would be set in an event driven GUI, and I needed to know if an
attribute had been set before I saved the information. Now that I have
thought more about it, an hash table would be a better choice.



More information about the Python-list mailing list