[Tutor] extreme basics
alan.gauld at btinternet.com
Mon Jan 5 19:25:18 CET 2009
"Mr Gerard Kelly" <s4027340 at student.uq.edu.au> wrote
> This is extremely weird, I think.
No, its normal and you got the right reason.... its due to floating
binary representation issues.
> Here is a tiny program:
> from math import *
> from Numeric import *
This is probably a bad idea here (in fact its usually a bad idea!)
both math and numeric are likely to have similar names in them
By importing all names from the modules there is a high chance
of name clashes causing strange behaviour.
Better to use
import math, Numeric
Or, if that's too much typing, use
import math as M
import Numeric as N
> for counter in rangelen((x)):
> print x
Although of course you are not using anything from either math or
Numeric in this example, but I assume you intend to!?
Author of the Learn to Program web site
More information about the Tutor