[Python-ideas] C# style properties

Steven Bethard steven.bethard at gmail.com
Thu Jul 12 18:40:15 CEST 2007


On 7/12/07, Christian Heimes <lists at cheimes.de> wrote:
> What do you think about this syntax?
>
> class EasyExample:
>     _a = 0.0
>     property a:
>         """doc string
>         """
>         def get(self) -> float:
>             return self._a
>         def set(self, value):
>             self._a = float(value)
>         def delete(self):
>             del self._a

I'm pretty sure Guido's said before that he doesn't like the
get/set/del methods being indented more than other instance methods
would be. If you really like this style, you can get something like it
today using inner classes:

    http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442418

Steve
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy



More information about the Python-ideas mailing list