REPOST: Re: Properties fun with 2.2
Martin von Loewis
loewis at informatik.hu-berlin.de
Wed Dec 26 19:20:02 EST 2001
"Mike C. Fletcher" <mcfletch at rogers.com> writes:
> The "only defined properties" thing can be done with a __slots__
> definition in the object, but then there's no __dict__ in which to store
> the data (there must be some way to say "store in the slot", I just
> don't see it right now).
Delegating to a different attribute might be appropriate:
class X(object):
__slots__ = ['_a']
def set_a(self, val):
self._a = val
def get_a(self):
return self._a
a = property(get_a, set_a)
Regards,
Martin
========= WAS CANCELLED BY =======:
Path: news.sol.net!spool0-nwblwi.newsops.execpc.com!newsfeeds.sol.net!news-out.visi.com!hermes.visi.com!newsfeed.direct.ca!look.ca!nntp.kreonet.re.kr!feeder.kornet.net!news1.kornet.net!ua4canc3ll3r
From: Martin von Loewis <loewis at informatik.hu-berlin.de>
Newsgroups: comp.lang.python
Subject: cmsg cancel <j4d711h5u5.fsf at informatik.hu-berlin.de>
Control: cancel <j4d711h5u5.fsf at informatik.hu-berlin.de>
Date: Mon, 31 Dec 2001 03:15:49 GMT
Organization: A poorly-installed InterNetNews site
Lines: 2
Message-ID: <cancel.j4d711h5u5.fsf at informatik.hu-berlin.de>
NNTP-Posting-Host: 211.57.49.2
X-Trace: news2.kornet.net 1009776224 27193 211.57.49.2 (31 Dec 2001 05:23:44 GMT)
X-Complaints-To: usenet at news2.kornet.net
NNTP-Posting-Date: Mon, 31 Dec 2001 05:23:44 +0000 (UTC)
X-No-Archive: yes
X-Unac4ncel: yes
X-Commentary: I love NewsAgent 1.10 and the Sandblaster Cancel Engine Build 74 (19 March 1999)
This message was cancelled from within Mozilla.
More information about the Python-list
mailing list