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

[Python-Dev] anonymous blocks

[Python-Dev] anonymous blocks [Python-Dev] anonymous blocksBrian Sabbey sabbey at u.washington.edu
Tue Apr 19 21:11:01 CEST 2005
Shannon -jj Behrens wrote:
> Have you guys considered the following syntax for anonymous blocks?  I
> think it's possible to parse given Python's existing syntax:
>
>   items.doFoo(
>       def (a, b) {
>           return a + b
>       },
>       def (c, d) {
>           return c + d
>       }
>   )
>

There was a proposal in the last few days on comp.lang.python that allows 
you to do this in a way that requires less drastic changes to python's 
syntax.  See the thread "pre-PEP: Suite-Based Keywords" (shamless plug) 
(an earlier, similar proposal is here: 
http://groups.google.co.uk/groups?selm=mailman.403.1105274631.22381.python-list 
%40python.org ).

In short, if doFoo is defined like:

def doFoo(func1, func2):
 	pass

You would be able to call it like:

doFoo(**):
 	def func1(a, b):
 		return a + b
 	def func2(c, d):
 		return c + d

That is, a suite can be used to define keyword arguments.

-Brian
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