[Patches] [Patch #103265] Let time functions default to 'now' (where it makes sense)

noreply@sourceforge.net noreply@sourceforge.net
Wed, 17 Jan 2001 01:24:20 -0800


Patch #103265 has been updated. 

Project: python
Category: Modules
Status: Open
Submitted by: twouters
Assigned to : twouters
Summary: Let time functions default to 'now' (where it makes sense)

Follow-Ups:

Date: 2001-Jan-17 01:24
By: twouters

Comment:

Calling floattime() only when necessary would be nice, but isn't possible
without a value that reads as 'empty'. There is no way to see whether
optional values of a ParseTuple call were filled or not, except by
comparing the old value with the new one, and that means making a token
float value that means 'no argument'. We could check the length of 'args'
to see howmany arguments it contains, but that is a very fragile way, and
breaks the wonderful transparentness of argument-passing and PyArg_Parse*.

The alternative to this approach is not reading a double from the arglist,
but a Python object (initialized as NULL,) and converting that to a float.
That would have my preference over the other two options, above, but I
still prefer the current way -- much less code, not that much slower (if
slower at all, I didn't time it.)

(Unless of course there is a way to see howmany optional arguments were
used ? Like a separate format character that fills an int with that
information, or a separate PyArg API call that returns not success/failure,
but the number of optional arguments used, and -1 on failure.)

I'll add news + docs, too,  sometime before friday if work permits :P

-------------------------------------------------------

Date: 2001-Jan-16 20:29
By: gvanrossum

Comment:
How hard would it be to avoid calling floattime() when an argument is
present (in gmtime() and localtime())?

Missing: docs, NEWS item.

Otherwise, great -- ready to check in if you fix the above things!


-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=103265&group_id=5470