f



RE: Is time.time() < time.time() always true?

Chris Mellon wrote:

> On 21 Nov 2006 15:10:25 -0800, flamesrock <flamesrock@gmail.com>
> wrote:=20
>> So, I was blazin' some mad chronix, as they say, and got on to
>> thinking about Python.=20
>>=20
>> The question was, is the statement:
>>=20
>> time.time() < time.time()
>>=20
>> always true? Seems it should be false, since the statement itself
>> occurs at one time instant.. but of course we know that python
>> doesn't execute code that way.. So my question is, why doesn't
>> Python work this way?=20
>>=20
>=20
> This would only be false if the time between the 2 calls was less than
> the precision of the OS call that time.time uses.

So long as the clock on the machine it's running on is not set backwards
between the two calls, you can guarantee that

   time.time() <=3D time.time()

will always evaluate true.

However, it's always possible (though incredibly unlikely) that an
external process changes the clock between the two system calls that are
made.

Tim Delaney
0
tdelaney (433)
11/21/2006 11:33:54 PM
comp.lang.python 77058 articles. 6 followers. Post Follow

0 Replies
1100 Views

Similar Articles

[PageSpeed] 17

Reply: