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/2004-April/043949.html below:

Decorators last before colon -- another new syntax idea

[Python-Dev] Re: PEP 318: Decorators last before colon -- another new syntax idea [Python-Dev] Re: PEP 318: Decorators last before colon -- another new syntax ideaAndrew Koenig ark-mlist at att.net
Fri Apr 2 09:40:08 EST 2004
> Has something along these lines been discussed?
> 
>   with [staticmethod, classmethod]:
> 
>      def foo(x):
>          pass
> 
>      def bar(x):
>          pass
> 
> IIUC, the PyObjC application needs whole swathes of functions with
> the same decoration, but this syntax isn't much worse for one
> function than for many.

If I understand it correctly, the motivation for this idea is to try to
avoid cluttering the definitions with large numbers of decorators.

In which case, how about this?

	sc = [staticmethod, classmethod]

	def foo(x) sc:
		pass

	def bar(x) sc:
		pass

In other words, if the decorators are too voluminous, do what you always do
with a complicated expression:  Bind a variable to it and use the variable
instead.


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