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

[Python-Dev] an alternative to embedding policy in PEP 418 (was: PEP 418: Add monotonic clock)

[Python-Dev] an alternative to embedding policy in PEP 418 (was: PEP 418: Add monotonic clock) [Python-Dev] an alternative to embedding policy in PEP 418 (was: PEP 418: Add monotonic clock)Oleg Broytman phd at phdru.name
Wed Apr 4 21:24:36 CEST 2012
On Wed, Apr 04, 2012 at 11:03:02AM -0700, Ethan Furman wrote:
> Oleg Broytman wrote:
> >   . Pythonic equivalent of "get_clock(THIS) or get_clok(THAT)" is
> >
> >for flag in (THIS, THAT):
> >    try:
> >        clock = get_clock(flag)
> >    except:
> >        pass
> >    else:
> >        break
> >else:
> >    raise ValueError('Cannot get clock, tried THIS and THAT')
> 
> 
> Wow -- you'd rather write nine lines of code instead of three?
> 
> clock = get_clock(THIS) or get_clock(THAT)
> if clock is None:
>     raise ValueError('Cannot get clock, tried THIS and THAT')

   Yes - to force people to write the last two lines. Without forcing
most programmers will skip them.

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            phd at phdru.name
           Programmers don't die, they just GOSUB without RETURN.
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