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