A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2005-October/057560.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?Josiah Carlson jcarlson at uci.edu
Mon Oct 24 10:19:23 CEST 2005
Michele Simionato <michele.simionato at gmail.com> wrote:
> 
> On 10/23/05, Nick Coghlan <ncoghlan at gmail.com> wrote:
> > Very nice indeed. I'd be more supportive if it was defined as a new statement
> > such as "create" with the syntax:
> >
> >    create TYPE NAME(ARGS):
> >      BLOCK
> 
> I like it, but it would require a new keyword. Alternatively, one
> could abuse 'def':
> 
> def  TYPE NAME(ARGS):
>       BLOCK
> 
> but then people would likely be confused as Skip was, earlier in this thread,
> so I guess 'def' is a not an option.
> 
> IMHO a new keyword could be justified for such a powerful feature,
> but only Guido's opinion counts on this matters ;)
> 
> Anyway I expected people to criticize the proposal as too powerful and
> dangerously close to Lisp macros.

I would criticise it for being dangerously close to worthless.  With the
minor support code that I (and others) have offered, no new syntax is
necessary.

You can get the same semantics with...

class NAME(_(TYPE), ARGS):
    BLOCK

And a suitably defined _.  Remember, not every X line function should be
made a builtin or syntax.

 - Josiah

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