Working with decimals

Chris Angelico rosuav at gmail.com
Sun Aug 24 22:27:18 EDT 2014


On Mon, Aug 25, 2014 at 12:16 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> Joshua Landau wrote:
>
>
>>>>> python -c "import sys; print('math' in sys.modules)"
>> False
>>
>> An even easier check:
>>
>>>>> python -c "import time; a = time.time(); import math; b = time.time();
>>>>> print(b-a)"
>> 0.0006012916564941406
>>
>>>>> python -c "import math, time; a = time.time(); import math; b =
>>>>> time.time(); print(b-a)"
>> 9.5367431640625e-06
>
>
> I wouldn't exactly say that *two* calls to Python, each containing *five*
> statements, followed by a visual comparison of two decimal numbers,
> is "even easier" than a single call to Python, containing just two
> statements :-)

I love this list. We can go off on a ridiculously long tangent, simply
because I said that it's only *usually* best to put imports at the top
of the file. We all agree that it normally is indeed best to hoist
them, and here we are, arguing over measurement methods on whether or
not there's ever any benefit to importing inside a function.

Yep, the Cheshire Cat was right. We're all mad here!

ChrisA



More information about the Python-list mailing list