Any syntactic cleanup likely for Py3? And what about doc standards?
Torsten Bronger
bronger at physik.rwth-aachen.de
Wed Sep 5 16:15:01 EDT 2007
Hallöchen!
Ferenczi Viktor writes:
> [...]
>
> Class decorators allows clean implementation of properties.
> Detailed description: http://www.python.org/dev/peps/pep-3129/
> Lets use a hypothetic library providing properties, for example:
>
> from property_support import hasProperties, Property
>
> @hasProperties
> class Sphere(object):
> def setRadius(self, value):
> ... some setter implementation ...
> radius=Property(default=1.0, set=setRadius, type=(int, float))
> color=Property(default='black', allowNone=True)
>
> This is a cleaner syntax if you need automatic default
> setter/getter implementations with type checking, default values,
> etc.
Well, I think @hasProperties is very ugly. Such things always look
like a dirty trick. The programmer wonders why the language cannot
detect by itself that there are properties in this class. But
anyway ... would these properties finally be virtual?
Tschö,
Torsten.
--
Torsten Bronger, aquisgrana, europa vetus
Jabber ID: bronger at jabber.org
(See http://ime.webhop.org for ICQ, MSN, etc.)
More information about the Python-list
mailing list