[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 19:44:49 CEST 2012

On Wed, Apr 04, 2012 at 05:47:16PM +0200, Lennart Regebro wrote:
> On Tue, Apr 3, 2012 at 18:07, Ethan Furman <ethan at stoneleaf.us> wrote:
> > What's unclear about returning None if no clocks match?
> Nothing, but having to check error values on return functions are not
> what you typically do in Python. Usually, Python functions that fail
> raise an error.

   Absolutely. "Errors should never pass silently."

> Please don't force Python users to write pseudo-C code in Python.

   +1. Pythonic equivalent of "get_clock(THIS) or get_clok(THAT)" is

for flag in (THIS, THAT):
        clock = get_clock(flag)
    raise ValueError('Cannot get clock, tried THIS and THAT')

     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