all() returns different values for the same expression
python
Solution
To access the builtin `all()` when it's being smashed, you can import `builtins`. E.g:
from builtins import all
(Below the line where `pylab` is imported).
Alternatively, if you need to access `pylab.all()`, you can do:
import builtins
...
builtins.all()
Or, better yet, do `import pylab` rather than `from pylab import *`.
You might want to file a bug report with `pylab` too, that's seriously bad behaviour. Although do note the `import * from ...` usage of imports is discouraged for this reason.
As DSM points out in the comments, this is presuming you are using 3.x, under 2.x, it is `__builtin__`.
Problem
I'm facing a very weird problem in my python script when I use the function `all()`. The console gives me `false` (which is obviously correct) for this line: ``` all(x == 2 for x in (8,2,2,2)) ``` and in my script the same line returns `true`?! What is going on here? Are there other `all()` function which could have overwritten it in my script? I'm importing the following modules: ``` import os import sys import string import time from time import gmtime, strftime from optparse import OptionParser, OptionGroup import cx_Oracle from pylab import * import ROOT from array import array import logging from traceback import format_exc ```