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.
...ces) is callled HelperClass1. We now (manually) instantiate MetaClass1 once to get an empty special base class: BaseClass1 = MetaClass1("BaseClass1", (), {}) We can now use BaseClass1 as a base class in a class statement: class MySpecialClass(BaseClass1): i = 1 def f(s): pass At this point, MySpecialClass is defined; it is a metainstance of MetaClass1 just like BaseClass1, and in fact the expression ``BaseClass1.__class__ == MySpecialClass.__class__ == MetaClass...
...case, manually delete the shortcut, and create new shortcuts with the command "C:\Program Files\python24\pythonw.exe" and the command line options "C:\Program Files\python24\Lib\idlelib\idle.pyw" and "C:\Program Files\python24\Tools\scripts\pydocgui.pyw" This will not be a problem if Python is installed into its default location (i.e. c:\python24). IDLE now executes code in a separate process. To communicate between the main process and executing processes, IDLE o...
...custom IDLE color syntax settings can no longer start IDLE. If this is the case, manually delete $HOME/.idlerc. When IDLE restarts, it should produce a clean set of configuration files. See SourceForge number 1080387. The Windows installer will not add correct IDLE and PyDoc entries when the Python target directory contains a space in its name (e.g. C:\Program Files\python24). In this case, manually delete the shortcut, and create new shortcuts with the command "C:\Program Files\python2...
...class constraint. For example: # Metaclasses class M1(type): ... class M2(M1): ... class M3(M2): ... class M4(type): ... # Regular classes class C1: __metaclass__ = M1 class C2(C1): __metaclass__ = M2 class C3(C1, C2): __metaclass__ = M3 class D(C2, C3): __metaclass__ = M1 class C4: __metaclass__ = M4 class E(C3, C4): pass For class C2, the constraint is satisfied because M2 is a subclass of M1. For class C3, it is satisfied because M3 is a...
...classes class C1: __metaclass__ = M1 class C2(C1): __metaclass__ = M2 class C3(C1, C2): __metaclass__ = M3 class D(C2, C3): __metaclass__ = M1 class C4: __metaclass__ = M4 class E(C3, C4): pass For class C2, the constraint is satisfied because M2 is a subclass of M1. For class C3, it is satisfied because M3 is a subclass of both M1 and M2. For class D, the explicit metaclass M1 is not a subclass of the ...
...chives. codecs - support for Unicode encoders/decoders. unicodedata - provides access to the Unicode 3.0 database. _winreg - Windows registry access. encodings - package which provides a large set of standard codecs -- currently only for the new Unicode support. It has a drop-in extension mechanism which allows you to add new codecs by simply copying them into the encodings package directory. Asian codec support will probably be made available as separate distribution package bui...
...C compiler. The PyXML prerequisite in particular causes a cyclic dependency, which could be resolved by including the generated C files with the distribution. Due to usage of flex, 4XPath is not capable of fully supporting Unicode in XPath expressions. There are patches circulating for flex 2.5.4 to allow scanning wchar_t strings; it is not clear whether these patches would allow to implement full Unicode support for an XPath scanner. Due to usage of callbacks...
...ceptionMatches(PyObject *); int PyErr_GivenExceptionMatches(PyObject *, PyObject *); void PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); PyErr_ExceptionMatches(exception) should be used in preference over PyErr_Occurred()==exception, since the latter will return an incorrect result when the exception raised is a class derived from the exception tested for. PyErr_GivenExceptionMatches(raised_exception, exception) performs the same test as PyErr_ExceptionMatches() bu...
...ctures, and executes typical code much slower than Python. Tcl also lacks features needed for writing large programs, such as modular namespaces. Thus, while a "typical" large application using Tcl usually contains Tcl extensions written in C or C++ that are specific to that application, an equivalent Python application can often be written in "pure Python". Of course, pure Python development is much quicker than having to write and debug a C or C++ component. It has been said that Tcl's...
...chives. codecs - support for Unicode encoders/decoders. unicodedata - provides access to the Unicode 3.0 database. _winreg - Windows registry access. encodings - package which provides a large set of standard codecs -- currently only for the new Unicode support. It has a drop-in extension mechanism which allows you to add new codecs by simply copying them into the encodings package directory. Asian codec support will probably be made available as separate distribution package built upon this tec...
...cutes code in a separate process. To communicate between the main process and executing processes, IDLE opens a socket to 127.0.0.1 (the local machine). Some firewalls running on Windows machines interfere with this and can cause either silent failures or erroneous popup windows from the firewall. This problem only occurs if you run a firewall on the same machine as IDLE. IDLE fails to start on Windows if installed to a directory with a space (e.g. C:\Program Files). Fix the problem by insta...
...ccepts keyword arguments cmp, key and reverse sorted() - a new builtin sorted() acts like an in-place list.sort() but can be used in expressions, as it returns a copy of the sequence, sorted. string methods - strings gained an rsplit() method, and the string methods ljust(), rjust() and center() accept an argument to specify the fill character. eval() now accepts any form of object that acts as a mapping as its argument for locals, rather than only accepting a dictionary. There's all sorts of n...
...cess control. Unlike Unix shell scripting, Python can be embedded whole as a scripting language within a larger software system. In this case, Python code can invoke specific functions of that system, even if those functions are written in C or C++. And C and C++ code can easily make calls back into Python code as well. Using this capability, ILM integrated Python into custom applications written in C or C++, such as ILM's in-house lighting tool, which is used to place light sources into a 3D s...
...class C. For instance, in the case of single inheritance hierarchy, if C is a subclass of C1, and C1 is a subclass of C2, then the linearization of C is simply the list [C, C1 , C2]. However, with multiple inheritance hierarchies, the construction of the linearization is more cumbersome, since it is more difficult to construct a linearization that respects local precedence ordering and monotonicity. I will discuss the local precedence ordering later, but I can give the definition of monotonicit...
...cribed by PEP 214. Optional Collection of Cyclical Garbage Python is now equipped with a garbage collector that can hunt down cyclical references between Python objects. It's no replacement for reference counting; in fact, it depends on the reference counts being correct, and decides that a set of objects belong to a cycle if all their reference counts can be accounted for from their references to each other. This devious scheme was first proposed by Eric Tiedemann, and brought t...
...cause Python's cyclic gc had no knowledge of Python's weakref objects. It does now. When weakrefs with callbacks become part of cyclic garbage now, those weakrefs are cleared first. The callbacks don't trigger then, preventing the problems. If you need callbacks to trigger, then just as when cyclic gc is not involved, you need to write your code so that weakref objects outlive the objects they weakly reference. Critical bugfix, for SF bug 840829: if cyclic garbage collection happened to occ...
...C API has been changed. Extensions that use the old API will still compile but will not participate in GC. To upgrade an extension module: rename Py_TPFLAGS_GC to PyTPFLAGS_HAVE_GC use PyObject_GC_New or PyObject_GC_NewVar to allocate objects and PyObject_GC_Del to deallocate them rename PyObject_GC_Init to PyObject_GC_Track and PyObject_GC_Fini to PyObject_GC_UnTrack remove PyGC_HEAD_SIZE from object size calculations remove calls to PyObject_AS_GC and PyObject_FROM_GC Two new functions:...
If you didn't find what you need, try your search in the Python language documentation.