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-August/046716.html below:

[Python-Dev] 2.4a2, and @decorators

[Python-Dev] 2.4a2, and @decoratorsMark Russell marktrussell at btopenworld.com
Tue Aug 3 13:06:54 CEST 2004
On Tue, 2004-08-03 at 05:17, James Y Knight wrote:
> Things someone might want to do, ordered roughly from most reasonable 
> to least reasonable ;)
> @foo().bar()
> @foo or bar
> @mydecorators['foo']
> @lambda f: foo(f) or bar(f)
> 
> Why disallow these forms? It seems quite difficult, especially, to 
> explain why the first one does not, or should not, work.

I don't think any of these seem that likely in practice, and if you do
want them, it is not hard to say:

	# Hopefully some comment here explaining the reason why you're
	# doing this.  And a more meaningful name than foo_or_bar!
	foo_or_bar = foo or bar

	@foo_or_bar
	def func(): pass

I would say leave it like this for now.  It is easy to relax the
restriction later if there's a demand.

Mark

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