On Thu, Apr 5, 2012 at 21:57, Stephen J. Turnbull step...@xemacs.org wrote:
I might have chosen to implement a 'None' return if I had designed
open(), but I can't get too upset about raising an Exception as it
actually does.
One fundamental difference is that there are many reasons one might
On Thu, Apr 5, 2012 at 8:05 AM, Oleg Broytman p...@phdru.name wrote:
Well, I am partially retreat. Errors should never pass silently.
Unless explicitly silenced. get_clock(FLAG, on_error=None) could return
None.
I still don't see what's erroneous about returning None when asked for
an object
On Thu, Apr 05, 2012 at 10:06:38PM +0900, Stephen J. Turnbull wrote:
On Thu, Apr 5, 2012 at 8:05 AM, Oleg Broytman p...@phdru.name wrote:
Well, I am partially retreat. Errors should never pass silently.
Unless explicitly silenced. get_clock(FLAG, on_error=None) could return
None.
I
On Thu, Apr 5, 2012 at 10:34 PM, Oleg Broytman p...@phdru.name wrote:
Why doesn't open() return None for a non-existing file? or
socket.gethostbyname() for a non-existing name?
That's not an answer to my question, because those calls have very
important use cases where the user knows the
On Thu, Apr 05, 2012 at 11:45:06PM +0900, Stephen J. Turnbull wrote:
On Thu, Apr 5, 2012 at 10:34 PM, Oleg Broytman p...@phdru.name wrote:
Why doesn't open() return None for a non-existing file? or
socket.gethostbyname() for a non-existing name?
That's not an answer to my question,
On Thu, 05 Apr 2012 19:22:17 +0400, Oleg Broytman p...@phdru.name wrote:
On Thu, Apr 05, 2012 at 11:45:06PM +0900, Stephen J. Turnbull wrote:
On Thu, Apr 5, 2012 at 10:34 PM, Oleg Broytman p...@phdru.name wrote:
 Why doesn't open() return None for a non-existing file? or
On Thu, Apr 05, 2012 at 07:22:17PM +0400, Oleg Broytman wrote:
On Thu, Apr 05, 2012 at 11:45:06PM +0900, Stephen J. Turnbull wrote:
find it
hard to imagine use cases where file = open(thisfile) or
open(thatfile) makes sense. Not even for the case where thisfile ==
'script.pyc' and
On Thu, Apr 05, 2012 at 11:38:13AM -0400, R. David Murray wrote:
Do you really think we need to add a third clock function (the query
function) that just returns True or False? Maybe we do, if actually
creating the clock could raise an error even if exists, as is the case
for 'open'.
May
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
On Thu, Apr 05, 2012 at 11:56:00AM -0700, Ethan Furman wrote:
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.
Oleg Broytman wrote:
On Thu, Apr 05, 2012 at 11:56:00AM -0700, Ethan Furman wrote:
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
On 05Apr2012 03:05, Oleg Broytman p...@phdru.name 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
|
On 06Apr2012 00:15, Oleg Broytman p...@phdru.name wrote:
|So we can argue in circles both ways, there are too many arguments
| pro and contra. Python is just too inconsistent to be consistently
| argued over. ;-)
Bah! I think these threads demonstrate that we can consistently argue
over
On Fri, Apr 6, 2012 at 12:22 AM, Oleg Broytman p...@phdru.name wrote:
On Thu, Apr 05, 2012 at 11:45:06PM +0900, Stephen J. Turnbull wrote:
On Thu, Apr 5, 2012 at 10:34 PM, Oleg Broytman p...@phdru.name wrote:
Why doesn't open() return None for a non-existing file? or
socket.gethostbyname()
(Sorry, should have sent to the list).
On 4 April 2012 01:04, Greg Ewing greg.ew...@canterbury.ac.nz wrote:
Cameron Simpson wrote:
People have been saying hires throughout the
threads I think, but I for one would be slightly happier with highres.
hirez?
What's wrong with high_resolution?
On Tue, Apr 3, 2012 at 18:07, Ethan Furman et...@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
Lennart Regebro wrote:
On Tue, Apr 3, 2012 at 18:07, Ethan Furman et...@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
On Wed, Apr 04, 2012 at 05:47:16PM +0200, Lennart Regebro wrote:
On Tue, Apr 3, 2012 at 18:07, Ethan Furman et...@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
Am 04.04.2012 18:18, schrieb Ethan Furman:
Lennart Regebro wrote:
On Tue, Apr 3, 2012 at 18:07, Ethan Furman et...@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
Oleg Broytman wrote:
On Wed, Apr 04, 2012 at 05:47:16PM +0200, Lennart Regebro wrote:
On Tue, Apr 3, 2012 at 18:07, Ethan Furman et...@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
Georg Brandl wrote:
Am 04.04.2012 18:18, schrieb Ethan Furman:
Lennart Regebro wrote:
On Tue, Apr 3, 2012 at 18:07, Ethan Furman et...@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
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
Oleg Broytman wrote:
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
On 04Apr2012 19:47, Georg Brandl g.bra...@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 et...@stoneleaf.us wrote:
| What's unclear about returning None if no clocks match?
|
| Nothing, but having to check
On Wed, Apr 04, 2012 at 12:52:00PM -0700, Ethan Furman wrote:
Oleg Broytman wrote:
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 =
On 03Apr2012 07:51, Lennart Regebro rege...@gmail.com wrote:
| I like the aim of letting the user control what clock it get, but I
| find this API pretty horrible:
|
| clock = get_clock(T_MONOTONIC|T_HIRES) or get_clock(T_MONOTONIC)
FWIW, the leading T_ is now gone, so it would now read:
On 03/04/2012 07:03, Cameron Simpson wrote:
On 03Apr2012 07:51, Lennart Regebrorege...@gmail.com wrote:
| I like the aim of letting the user control what clock it get, but I
| find this API pretty horrible:
|
|clock = get_clock(T_MONOTONIC|T_HIRES) or get_clock(T_MONOTONIC)
FWIW, the
On 03Apr2012 09:03, Mark Lawrence breamore...@yahoo.co.uk wrote:
| On 03/04/2012 07:03, Cameron Simpson wrote:
| On 03Apr2012 07:51, Lennart Regebrorege...@gmail.com wrote:
| | I like the aim of letting the user control what clock it get, but I
| | find this API pretty horrible:
| |
| |
On Tue, Apr 3, 2012 at 08:03, Cameron Simpson c...@zip.com.au wrote:
clock = get_clock(MONOTONIC|HIRES) or get_clock(MONOTONIC)
If the symbol names are not the horribleness, can you qualify what API
you would like more?
Well, get_clock(monotonic=True, highres=True) would be a vast
Lennart Regebro wrote:
On Tue, Apr 3, 2012 at 08:03, Cameron Simpson c...@zip.com.au wrote:
clock = get_clock(MONOTONIC|HIRES) or get_clock(MONOTONIC)
If the symbol names are not the horribleness, can you qualify what API
you would like more?
Well, get_clock(monotonic=True, highres=True)
On 03Apr2012 09:07, Ethan Furman et...@stoneleaf.us wrote:
| Lennart Regebro wrote:
| On Tue, Apr 3, 2012 at 08:03, Cameron Simpson c...@zip.com.au wrote:
| clock = get_clock(MONOTONIC|HIRES) or get_clock(MONOTONIC)
|
| If the symbol names are not the horribleness, can you qualify what API
|
Cameron Simpson wrote:
get_clock already has two arguments - you can optionally hand it a clock
list - that's used by monotonic_clock() and hires_clock().
def get_clock(*flags, *, clocklist=None):
''' Return a Clock based on the supplied `flags`.
The returned clock shall have all
On 03Apr2012 15:08, Ethan Furman et...@stoneleaf.us wrote:
| Cameron Simpson wrote:
| get_clock already has two arguments - you can optionally hand it a clock
| list - that's used by monotonic_clock() and hires_clock().
|
| def get_clock(*flags, *, clocklist=None):
I presume that bare *, is a
| get_clock() returns None if no clock has the requested flags, whereas
| I expected an exception (LookupError or NotImplementError?).
That is deliberate. People can easily write fallback like this:
clock = get_clock(T_MONOTONIC|T_HIRES) or get_clock(T_MONOTONIC)
Why not passing a a list
On Wed, Apr 4, 2012 at 9:38 AM, Cameron Simpson c...@zip.com.au wrote:
I could do this. I think I'm -0 on it, because it doesn't seem more
expressive to my eye than the straight make-a-bitmask | form.
Other opinions?
Yes. I've been mostly staying out of the PEP 418 clock discussion
(there are
Cameron Simpson wrote:
People have been saying hires throughout the
threads I think, but I for one would be slightly happier with highres.
hirez?
--
Greg
___
Python-Dev mailing list
Python-Dev@python.org
On 04/04/2012 01:04, Greg Ewing wrote:
Cameron Simpson wrote:
People have been saying hires throughout the
threads I think, but I for one would be slightly happier with highres.
hirez?
IMHO still too easy to read as hires. Or is it? Bah I'm going to bed
and will think about it, night
On 04Apr2012 01:45, Victor Stinner victor.stin...@gmail.com wrote:
| | get_clock() returns None if no clock has the requested flags, whereas
| | I expected an exception (LookupError or NotImplementError?).
|
| That is deliberate. People can easily write fallback like this:
|
| clock =
I've just finished sketching out a skeleton here:
https://bitbucket.org/cameron_simpson/css/src/fb476fcdcfce/lib/python/cs/clockutils.py
get_clock() returns None if no clock has the requested flags, whereas
I expected an exception (LookupError or NotImplementError?).
get_clock() doesn't
On 02Apr2012 13:37, Victor Stinner victor.stin...@gmail.com wrote:
| I've just finished sketching out a skeleton here:
|
https://bitbucket.org/cameron_simpson/css/src/fb476fcdcfce/lib/python/cs/clockutils.py
|
| get_clock() returns None if no clock has the requested flags, whereas
| I
On 03Apr2012 07:38, I wrote:
| On 02Apr2012 13:37, Victor Stinner victor.stin...@gmail.com wrote:
| | Could you please update your code according to my remarks? I will try
| | to integrate it into the PEP. A PEP should list all alternatives!
New code here:
On 03Apr2012 07:38, I wrote:
| On 02Apr2012 13:37, Victor Stinner victor.stin...@gmail.com wrote:
| | Should I use
| | MONTONIC_CLOCKS or HIRES_CLOCKS when I would like a monotonic and
| | high-resolution clock?
|
| Note that you don't need to provide a clock list at all; get_clock(0
| will use
On 03Apr2012 07:51, I wrote:
| Changelog: updates based on suggestions from Victor Stinner: flat API
| calls to get time directly, make now() a method instead of a property,
| default flags for get_clock(), adjust hr_clock() to hires_clock(0 for
| consistency.
BTW, I'd also happily change T_HIRES
I like the aim of letting the user control what clock it get, but I
find this API pretty horrible:
clock = get_clock(T_MONOTONIC|T_HIRES) or get_clock(T_MONOTONIC)
Just my 2 groszy.
//Lennart
___
Python-Dev mailing list
Python-Dev@python.org
On 28Mar2012 23:40, Victor Stinner victor.stin...@gmail.com wrote:
| Does this primarily give a high resolution clock, or primarily a
| monotonic clock? That's not clear from either the name, or the PEP.
|
| I expect a better resolution from time.monotonic() than time.time(). I
| don't have
45 matches
Mail list logo