Message248871
The only significant difference is that it lets the instance overwrite the attribute (it doesn't have __set__ or __delete__). For example (using fractions.Fraction to demonstrate), the following:
def __new__(cls, numerator=0, denominator=None, _normalize=True):
# ...
self._numerator = numerator
self._denominator = denominator
@property
def numerator(a):
return a._numerator
@property
def denominator(a):
return a._denominator
would become:
def __new__(cls, numerator=0, denominator=None, _normalize=True):
# ...
self.numerator = numerator
self.denominator = denominator
@attribute
def numerator(a):
pass
@attribute
def denominator(a):
pass
This is more of an aesthetic enhancement rather than a functional one. |
|
Date |
User |
Action |
Args |
2015-08-20 01:41:59 | abarry | set | recipients:
+ abarry, ethan.furman |
2015-08-20 01:41:59 | abarry | set | messageid: <1440034919.77.0.149653408635.issue24897@psf.upfronthosting.co.za> |
2015-08-20 01:41:59 | abarry | link | issue24897 messages |
2015-08-20 01:41:59 | abarry | create | |
|