Namespace question

Park997 park997 at aol.comnotospam
Tue Apr 3 12:11:18 EDT 2001


>> The "matrixmultiply" method from NumPy can be used with
>> no additional import statement, but the random.choice() method
>> will throw an AttributeError exception without another "import
>> random" statement. Why doesn't the first "import random" put
>> it into the module namespace?
>
>probably because there's something else called "random" in the
>Numeric (or more likely, RandomArray) module.

Yes this is exactly the problem. Dir(RandomArray)
shows a random.


>
>also see:
>
>    http://effbot.org/guides/import-confusion.htm
>
>Cheers /F
>
Thats a useful reference,

Thanks,

Wendell Cropper



More information about the Python-list mailing list