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

[Python-Dev] Simpler finalization semantics (was Re: PEP 343

[Python-Dev] Simpler finalization semantics (was Re: PEP 343 - Abstract Block Redux) [Python-Dev] Simpler finalization semantics (was Re: PEP 343 - Abstract Block Redux)Phillip J. Eby pje at telecommunity.com
Wed May 18 03:09:14 CEST 2005
At 12:48 PM 5/18/2005 +1200, Greg Ewing wrote:
>Nick Coghlan wrote:
>
> >    the_stmt = EXPR1
> >    stmt_enter = getattr(the_stmt, "__enter__", None)
> >    stmt_exit = getattr(the_stmt, "__exit__", None)
> >
> >    if stmt_enter is None:
> >        VAR1 = the_stmt
> >    else:
> >        VAR1 = stmt_enter()
>
>If we're doing this, it might be better if VAR were simply
>bound to EXPR in all cases. Otherwise the ability to liberally
>sprinkle with-statements around will be hampered by uncertainty
>about what kind of object VAR will end up being.

It'll be whatever kind of object you should get when you're using EXPR as a 
resource.  :)  In other words, it looks like normal duck typing to me: what 
you get when you access something.quack() is whatever 'something' thinks 
you should get.

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