get/set

Gerhard Häring gerhard at bigfoot.de
Fri May 10 14:35:42 EDT 2002


* Steve Holden <sholden at holdenweb.com> [2002-05-10 13:46 -0400]:
> "William Dode" <wilk at flibuste.net> wrote in message
> news:20020510192720.0823ed15.wilk at flibuste.net...
> > Le Fri, 10 May 2002 12:03:53 -0500
> > "Mark McEahern" <marklists at mceahern.com> écrivait:
> >
> 
> [property explanation]
> > it means that if i want to keep working with python 2.1 i need to use my
> > own get/set method ?
> >
> [property code]
> 
> Not at all: the bahavior Mark explains is only implemented when the class
> derives from "object" - a so-called "new-style" class. If there is no such
> derivaqtion ("classic" classes) then the behavior is just as it's always
> been.

But trying to derive from object or using 'property' will only lead to
NameErrors in older Pythons. So code using the new features simply won't
work.

Gerhard
-- 
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    http://www.cs.fhm.edu/~ifw00065/    OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9  3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))





More information about the Python-list mailing list