Unqualified global vars, how?

Josiah Carlson jcarlson at uci.edu
Mon Oct 25 19:49:06 EDT 2004


> C:\Temp>cat > Globals.py
> class GV:
>   val = 0
>     def __iadd__(self, arg):
>         self.val += arg
>         return self
>     def __repr__(self):
>         return repr(self.val)

Hrm, it doesn't look like the spacing was preserved, and it looks like
this caught my original val=0 version (and not my later val=1 version
that mirrors yours).

 - Josiah




More information about the Python-list mailing list