Does Python have Class methods

Emile van Sebille emile at fenx.com
Fri May 11 21:20:08 EDT 2001


"David Bolen" <db3l at fitlinxx.com> wrote in message
news:ur8xvtnl0.fsf at ctwd0143.fitlinxx.com...
> costas at meezon.com (Costas Menico) writes:
>
> > I have a class like this:
> >
> > # class stored in c:\fooclass.py
> > class fooClass:
> > nm = 1
> > def __init__(self):
> > pass
> >
> >
> > # Typed in interactive window
> > import sys
> > sys.path.append('c:\\')
> > import fooclass
> > f1 = fooclass.fooClass()
> > f1.nm + = 1   # increment to 2
> >

On first reading this, I was somewhat surprised that a NameError is not
generated at this point.  For some reason, this feels more like a
nested_scopes type behavior, mixed in with UnboundLocalError.  How was
that... locals, globals, builtins?  Somewhere along the line I missed the
part of the mantra that included classes...

You-learn-something-new-every-day-ly y'rs


--

Emile van Sebille
emile at fenx.com

---------





More information about the Python-list mailing list