Emanuel Barry added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24897>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to