In <[EMAIL PROTECTED]>, gel wrote:
> Yeah I am still getting my head around things... not exactly sure what
> you where saying about the globals, but this works
>
>
> global k
> k = 5
> class foo:
>
> def wow(self, n):
> global k
> k += n
> return k
>
>
> f=foo()
> f.wow(55)
The first ``global`` does nothing. ``global`` at module level makes no
sense. And the snippet could be easily written without assigning to
global names from within a function/method:
k = 5
class Foo:
def wow(self, n):
return k + n
f = Foo()
k = f.wow(55)
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list