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

[Python-Dev] Re: anonymous blocks

[Python-Dev] Re: anonymous blocks [Python-Dev] Re: anonymous blocksGreg Ewing greg.ewing at canterbury.ac.nz
Wed Apr 27 02:53:04 CEST 2005
Nick Coghlan wrote:

> def template():
>   # pre_part_1
>   yield None
>   # post_part_1
>   yield None
>   # pre_part_2
>   yield None
>   # post_part_2
>   yield None
>   # pre_part_3
>   yield None
>   # post_part_3
> 
> def user():
>   block = template()
>   with block:
>     # do_part_1
>   with block:
>     # do_part_2
>   with block:
>     # do_part_3

That's an interesting idea, but do you have any use cases
in mind?

I worry that it will be too restrictive to be really useful.
Without the ability for the iterator to control which blocks
get executed and when, you wouldn't be able to implement
something like a case statement, for example.

-- 
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg.ewing at canterbury.ac.nz	   +--------------------------------------+
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