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

Ethan Furman ethan at stoneleaf.us
Thu Apr 5 20:56:00 CEST 2012

Oleg Broytman wrote:
> On Wed, Apr 04, 2012 at 12:52:00PM -0700, Ethan Furman wrote:
>> Forced?  I do not use Python to be forced to use one style of
>> programming over another.
>    Then it's strange you are using Python with its strict syntax
> (case-sensitivity, forced indents), ubiquitous exceptions, limited
> syntax of lambdas and absence of code blocks (read - forced functions),
> etc.

I come from assembly -- 'a' and 'A' are *not* the same.

indents -- I already used them; finding a language that gave them the 
same importance I did was incredible.

exceptions -- Python uses them, true, but I don't have to in my own code 
(I do, but that's besides the point).

lambdas -- they work just fine for my needs.


>> And it's not like returning None will allow some clock calls to work
>> but not others -- as soon as they try to use it, it will raise an
>> exception.
>    There is a philosophical distinction between EAFP and LBYL. I am
> mostly proponent of LBYL.
>    Well, I am partially retreat. "Errors should never pass silently.
> Unless explicitly silenced." get_clock(FLAG, on_error=None) could return
> None.

It's only an error if it's documented that way and, more importantly, 
thought of that way.  The re module is a good example: if it can't find 
what you're looking for it returns None -- it does *not* raise a 
NotFound exception.

I see get_clock() the same way:  I need a clock that does xyz... None? 
Okay, there isn't one.


More information about the Python-Dev mailing list