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-May/053411.html below:

[Python-Dev] PEP 340: Breaking out.

[Python-Dev] PEP 340: Breaking out. [Python-Dev] PEP 340: Breaking out.Ron Adam rrr at ronadam.com
Thu May 5 18:48:29 CEST 2005
Eric Nieuwland wrote:

> This is linear. No looping whatsoever. And easily translated to a 
> simple language construct and a protocol:
> 
> class resource(object):
> 	def __init__(self,...):
> 		# store resource parameters
> 	def __acquire__(self):
> 		# whatever it takes to grab the resource
> 	def __release__(self):
> 		# free the resource


I wanted to see what the examples in PEP340 would look like written with 
standard class's using object inheritance and overriding to define
resource managers.  If anyone's interested I can post it.

My block class is non-looping as I found in most cases looping isn't 
required, and looping complicates things because you have to pass around 
a loop expression due to not all loops will want to behave that same way.

The solution was to put the loop in the body method and call a 
repeat_body method (the repeated body section) which is added to the 
class when needed.

Ron_Adam


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