Sharpened properties in Python

This is an implementation of a C#-like way of declaring properties in python, which in my opinion simplifies and cleans up the declaration of properties.

A declaration example:


from sharpened import property

class A(object): def init(self): self.__x = 0 @property def x(): """The immutable X property.""" def get(self): print 'get' return self.__x def set(self, value): print 'set'

It works just like regular properties do:

>>> a = A()
>>> print a.x
get
0
>>> a.x = 1
set
>>> print a.x
get
0
To download the module, click here.