Unqualified global vars, how?

Josiah Carlson jcarlson at uci.edu
Tue Oct 26 01:49:06 CEST 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