In article 
<[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] wrote:

> I imported two modules (random and matplotlib), and found that the
> functions available to me from the random module depended on the order
> in which the imports occured. In particular, if I import random first,
> none of its functions seem to be available, while if I import it after
> matplotlib, I seem to have access to all of its functions. What could
> the problem be?
> 
> Thomas Philips
> 
> 
> >>> import random
> >>> from pylab import *
> >>> x = random.uniform(0,1)
> 
> Traceback (most recent call last):
>   File "<pyshell#2>", line 1, in <module>
>     x = random.uniform(0,1)
> AttributeError: 'builtin_function_or_method' object has no attribute
> 'uniform'
> >>> help(random)
> Help on built-in function random_sample:

I'm guessing the module pylab has a symbol in it named "random", which is 
over-writing the name "random" you created with the first import.

Try changing it to:

import random
import pylab

and then referring to the things in pylab by their qualified 
(pylab.whatever) names.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to