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

Cameron Simpson cs at zip.com.au
Thu Apr 5 00:06:45 CEST 2012


On 04Apr2012 19:47, Georg Brandl <g.brandl at gmx.net> wrote:
| Am 04.04.2012 18:18, schrieb Ethan Furman:
| > 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. Please don't force Python users to write pseudo-C code
| >> in Python.
| > 
| > You mean like the dict.get() function?
| > 
| > --> repr({}.get('missing'))
| > 'None'
| 
| Strawman: this is not a failure.

And neither is get_clock() returning None. get_clock() is an inquiry
function, and None is a legitimate response when no clock is
satisfactory, just as a dict has no key for a get().

Conversely, monotonic() ("gimme the time!") and indeed time() should
raise an exception if there is no clock. They're, for want of a word,
"live" functions you would routinely embed in a calculation.

So not so much a straw man as a relevant illuminating example.
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

A crash reduces
your expensive computer
to a simple stone.
- Haiku Error Messages http://www.salonmagazine.com/21st/chal/1998/02/10chal2.html


More information about the Python-Dev mailing list