Arrays

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Nov 14 06:56:50 EST 2007


On Tue, 13 Nov 2007 20:25:07 -0500, Gordon C wrote:

> OK Steve, But why do we say "from array import array" and NOT  "from
> math import math"? Why the difference in syntax? 

It isn't different syntax. The difference is that there is a function 
"array" (technically, a type rather than a function) in the module 
"array", but there is no function "math" in the array "math". There is 
however a function sin, so you can do this:

from math import sin


Precisely the same syntax: "from <module-name> import <object-name>". 
Only the names are different.



-- 
Steven.



More information about the Python-list mailing list