I think this is because the built in function all() got mixed up with the numpy.all() function. That would happen after an import such as: from numpy import * It looks like it that the IPython console in spyder is loaded with a from numpy import * (although that has to be confirmed in the source and I can't find it that fast...). As a result, calling all() (or any other numpy.XXX module) overrules any Python built in function with the same name (such as all()).
The Python built in function all() requires an iterable as input argument and hence explains your error in the stand alone IPython console. Correct me if I am wrong, but isn't from XYZ import * considered as not so good Python programming practice? Regards, David On 4 March 2011 11:22, pmav99 <[email protected]> wrote: > consider the following code. > > In [1] : a = range(10) > In [2] : all(True if [i for i in a[:-2]] < [j for j in a[1:-1]] else > False) > > When I run it with the internal Ipython console it returns True: > Out [2] : True > > When I run with an Ipython console outside spyder it returns the > following error: > > In [2]: all(True if [i for i in a[:-2]] < [j for j in a[1:-1]] else > False) > --------------------------------------------------------------------------- > TypeError Traceback (most recent call > last) > /home/panos/Programming/Python/Various/<ipython console> in <module>() > TypeError: 'bool' object is not iterable > > Is this normal? > > -- > You received this message because you are subscribed to the Google Groups > "spyder" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/spyderlib?hl=en. > > -- You received this message because you are subscribed to the Google Groups "spyder" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.
