Notice: While JavaScript is not essential for this website, your interaction with the content will be limited. Please turn JavaScript on for the full experience.
...exec makes it impossible for the compiler to determine the exact set of local variables in the outer scope, which makes it impossible to determine the bindings for free variables in the inner scope. To avoid the warning about import *, change it into an import of explicitly name object, or move the import* statement to the global scope; to avoid the warning about bare exec, use exec...in... (a good idea anyway -- there's a possibility that bare exec will be deprecated in the future). Use of a g...
...exec") except SyntaxError, what: try: message, info = what except: message, info = what, None if info: "...print source code info..." print "SyntaxError:", msg
...exec - fully support Unicode, and no longer issue a SyntaxError when their input doesn't end with a newline. (New in 2.3a2.) range() - as of 2.3b1 supports long arguments with a magnitude larger than sys.maxint. E.g., range(2**100, 2**101, 2**100) is the following list: [1267650600228229401496703205376L]. dict() - two new features for dict construction: keyword arguments to the dict() constructor are now a shorthand for creating a dictionary from the key/value pairs, and dict.fromkeys(iterab...
...exec statement or the built-in function eval(): >>> print a.keys() [1, 2] >>> exec "x = 3; print x" in a 3 >>> print a.keys() ['__builtins__', 1, 2, 'x'] >>> print a['x'] 3 >>> However, our __getitem__() method is not used for variable access by the interpreter: >>> exec "print foo" in a Traceback (most recent call last): File "<stdin>", line 1, in ? File "<string>", line 1, in ? NameError: name 'foo' ...
...exec statement or the built-in function eval(): >>> print a.keys() [1, 2] >>> exec "x = 3; print x" in a 3 >>> print a.keys() ['__builtins__', 1, 2, 'x'] >>> print a['x'] 3 >>> However, our __getitem__() method is not used for variable access by the interpreter: >>> exec "print foo" in a Traceback (most recent call last): File "<stdin>", line 1, in ? File "<string>", line 1, in ? NameError: name 'foo' is not defined >>> Why doesn't this print 0.0? T...
...executed by exec() raises an exception, and sys.stdout.flush() also raises an error. Bug #2565: The repr() of type objects now calls them 'class', not 'type' - whether they are builtin types or not. The command line processing was converted to pass Unicode strings through as unmodified as possible; as a consequence, the C API related to command line arguments was changed to use wchar_t. All backslashes in raw strings are interpreted literally. This means that 'u' and 'U' escapes are not treated...
...ExecCodeModule() and PyImport_ExecCodeModuleEx(): if an error occurs while loading the module, these now delete the module's entry from sys.modules. All ways of loading modules eventually call one of these, so this is an error-case change in semantics for all ways of loading modules. In rare cases, a module loader may wish to keep a module object in sys.modules despite that the module's code cannot be executed. In such cases, the module loader must arrange to reinsert the name and module obj...
...exec.bat. Advanced Windows developers may also wish to download the Win32 extensions, by Mark Hammond of ActiveState. These make many Microsoft Windows APIs available from Python. Incompatibility warning: Norton Antivirus 2000 can cause blue screen crashes on Windows 98 when a function in the os.popen*() family is invoked. To prevent this problem, disable Norton Antivirus when using Python. (Confirmed on Windows 98 Second Edition with Norton Antivirus version 6.10.20. The same N...
...exec(, {}) don't have a __module__, but code in typeobject assumed it would always be there. Bug #952807: Unpickling pickled instances of subclasses of datetime.date, datetime.datetime and datetime.time could yield insane objects. Thanks to Jiwon Seo for a fix. Bug #845802: Python crashed when __init__.py is a directory. Bug #875692: Improve signal handling, especially when using threads, by forcing an early re-execution of PyEval_EvalFrame() "periodic" code when things_to_do is not ...
If you didn't find what you need, try your search in the Python language documentation.