From: Bruce S. <Bru...@nc...> - 2010-04-08 15:10:01
|
Guy is correct. Turns out that numpy contains a module numpy.random (which offers an extensive range of randomization options), and because numpy is imported by Visual, the numpy.random module overrides the earlier random import. Bruce Sherwood On 4/7/2010 10:29 PM, Guy K. Kloss wrote: > On Thu, 08 Apr 2010 14:16:00 Ron Adam wrote: > >> On a different note: >> >> I came across something which was just a minor annoyance, but maybe worth >> fixing. >> >> ra@Gutsy:~$ python >> Python 2.6.5 (r265:79063, Apr 3 2010, 01:56:30) >> [GCC 4.4.3] on linux2 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import random >> >>> from visual import * >> >>> random.choice(range(7)) >> Traceback (most recent call last): >> File "<stdin>", line 1, in<module> >> AttributeError: 'module' object has no attribute 'choice' >> >>> import random >> >>> random.choice(range(7)) >> 6 >> > I wouldn't bet on it, but I could imagine that this has got something to do > with the wild card imports within visual from numpy as well as certain other > modules. I've voted for some cleaning and sanity in there, and I hope that's > going to happen some day. > > Guy > > > > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > > > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > |