A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2005-October/057364.html below:

[Python-Dev] Definining properties - a use case for class decorators?

[Python-Dev] Definining properties - a use case for class decorators? [Python-Dev] Definining properties - a use case for class decorators?Delaney, Timothy (Tim) tdelaney at avaya.com
Mon Oct 17 04:39:15 CEST 2005
Greg Ewing wrote:

>    class C:
> 
>      foo = overridable_property('foo', "The foo property")
> 
>      def get_foo(self):
>        ...
> 
>      def set_foo(self, x):
>        ...
> 
> This has the advantage that the accessor methods can be
> overridden in subclasses with the expected effect.

This is a point I was going to bring up.

> The only wart is the necessity of mentioning the property
> name twice, once on the lhs and once as an argument.
> I haven't thought of a good solution to that, yet.

Have a look at my comment to Steven Bethard's recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/408713

Tim Delaney
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4