[Python-Dev] an alternative to embedding policy in PEP 418
cs at zip.com.au
Fri Apr 6 00:17:58 CEST 2012
On 05Apr2012 10:21, Lennart Regebro <regebro at gmail.com> wrote:
| On Thu, Apr 5, 2012 at 01:10, Victor Stinner <victor.stinner at gmail.com> wrote:
| > Ok for the default, but what happens if the caller sets an option to
| > False? Does get_clock(monotonic=False) return a non-monotonic clock?
| > (I guess no, but it may be confusing.)
This is where the bitmap approach can be less confusing - the docstring
says "The returned clock shall have all the requested flags". It is at
least very predictable.
| Good point, but the same does for using flags.
Only notionally. With a keyword argument the (lazy non doc reading)
caller can imagine the default is None, and True and False specify
concrete position and negative requirements. Not the case with a
bitmask, which only has two states per feature, not three (or
arbitrarily many, depending how nasty one wants to be - I could play
devil's advocate and ask for monotonic=0.7 and demand a competivtive
evaluation of relative merits:-)
| If you don't pass in
| the MONOTONIC flag, what happens? Only reading the documentation will
| tell you.
Gah! ALL functions are like that! How often do we see questions about
max() or split() etc that a close reading of the docs obviate?
| As such this, if anything, is an indication that the
| get_clock() API isn't ideal in any incarnation.
It's not meant to be ideal. I find that word almost useless in its
overuse. get_clock() is meant to be _very_ _often_ _useful_ and easy to
use for expressing simple fallback when the PEP418 monotonic() et al
calls don't fit.
For the truly arbitrary case the caller needs to be able to enumerate
all the available clocks and make their own totally ad hoc decision. My
current example code offers both public lock list names and get_clocks()
(just like get_clock() in signature, but returning all matches instead
of just the first one).
Cameron Simpson <cs at zip.com.au> DoD#743
From the EXUP mailing list <exup-brotherhood at Majordomo.net> ...
Wayne Girdlestone <WayneG at mega.co.za>:
WG> Let's say there are no Yamaha's or Kawa's in the world.
Stevey Racer <ssturm at co.la.ca.us>:
SR> sriw - so then you are saying that Revelations (from the Bible) has come
SR> true and Hell is now on Earth.
WG> Your choice for you new bike is either a new '98 fuel injected SRAD, or a
WG> new '98 Fireblade.
SR> sriw -The devil's minions - full of temptation but never fulfilling their
More information about the Python-Dev