On 24 August 2014 20:25, Joshua Landau <[email protected]> wrote:
> On 24 August 2014 20:19, Ian Kelly <[email protected]> wrote:
>> On Sun, Aug 24, 2014 at 1:17 PM, Ian Kelly <[email protected]> wrote:
>>> On Sun, Aug 24, 2014 at 1:12 PM, Joshua Landau <[email protected]> wrote:
>>> > Is math not already imported by start-up?
>
> I don't mean into the global namespace, but imported by other modules
> (like the builtins) and thus cached, making instantiation trivial.
Although it doesn't seem to be:
>>> 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 guess I'm just pessimistic. Even so, that's not much reason to hide
the import inside a function.
--
https://mail.python.org/mailman/listinfo/python-list