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.
...functions are by name, not by value -- two mutually recursive functions can still both have a reference count of one, since they do a name lookup for each other. C1 is an attempt to provide a way for a module to define globals that are deleted before anything else in the module. Since imported module or function names generally don't begin with an underscore, this means that such objects can be guaranteed that any imported modules or functions still exist when they are deleted -- pro...
...functions attrgetter() and itemgetter() The posix module (available as os) has a new function getsid() poplib supports POP over SSL profile can now profile C extension functions random has a new method getrandbits(N) to return a random integer N bits long. The re module was extended to allow simple conditional expressions in regular expressions. In addition, the underlying SRE engine is now non-recursive (previously, certain types of regular expression would run into troubles with recursion). Th...
...recursive data structure built out of new-style classes would cause infinite recursion. See <a href= "http://sourceforge.net/tracker/?func=detail&atid=105470&aid=497426&group_id=5470" >SourceForge bug report #497426</a>. <p><li>The Demo/extend subdirectory should not have been shipped; it contains an obsolete example. To build extensions, you should use distutils, which is documented extensively in the standard <a href="http://docs.python....
...recursive traversal, potentially resulting in reduced functionality of XML-RPC applications depending on this feature.</p> <p><b>Acknowledgement:</b> thanks to Graham Dumpleton for reporting this issue.</p> <hr> <h3>Postscripts</h3> <p>The fix for this problem has been incorporated into <a href="/download/releases/2.3.5/" >Python 2.3.5</a>, which was released on Feb 8th, 2005, and into <a href="/download/releases...
...recursive data structures os - new functions isatty, seteuid, setegid, setreuid, setregid os/popen2 - popen2/popen3/popen4 support under Windows. popen2/popen3 support under Unix. os/pty - support for openpty and forkpty os.path - fix semantics of os.path.commonprefix smtplib - support for sending very long messages socket - new function getfqdn() readline - new functions to read, write and truncate history files. The readline section of the library reference manual conta...
...functions are about as simple as they get. Yet, they are nearly optimal (for code written in Python). In another Python Patterns column, I will try to analyze their running speed and improve their performance, at the cost of more code. UPDATE: Eryk KopczyĆski pointed out that these functions are not optimal. To the contrary, "this program runs in exponential time, while find_shortest_path can be done in linear time using BFS [Breadth First Search]. Furthermore a linear BFS is simpler...
...recursive dictionaries and lists no longer causes a core dump. A raise statement without arguments re-raises the last exception raised in the current function. The import statement is now serialized between different threads. The finalization order is much more sensible. On Mac and Windows, the case of module file names must match the case as used in the import statement. (On Unix, this was always true, of course.) When you specify the -t option, the tokenizer warns about inconsistent mixing of...
...functions, attrgetter() and itemgetter() which are useful for creating fast data extractor functions for map(), list.sort(), itertools.groupby(), and other functions that expect a function argument. socket.SHUT_{RD,WR,RDWR} was added. os.getsid was added. The pwd module incorrectly advertised its struct type as struct_pwent; this has been renamed to struct_passwd. (The old name is still supported for backwards compatibility.) The xml.parsers.expat module now provides Expat 1.95.7. socket.IPPROT...
...functions. The constructors have the same signature as the functions in the past. PyThreadState_SetAsyncEnc() - A new API (deliberately accessible only from C) to interrupt a thread by sending it an exception. New or upgraded modules and packages Many new doctest extensions from Jim Fulton, which among other enhancements, allows doctests to be run by unittests. csv - support for reading and writing files in so-called comma-separated-value format. (New in 2.3b1.) timeit - module to time t...
...functions The previous section showed that an instance of the built-in subtype defaultdict can be created by calling defaultdict(). This is expected, because this also works for classic classes. But here's a new feature: built-in base types themselves can also be instantiated by calling the type directly. For several built-in types, there are already factory functions named after the type in classic Python, for example str() and int(). I've changed these built-ins so that they are ...
...recursive-descent strategy, it turned out that the XPath grammar could easily be rewritten to be acceptable using standard techniques. For example, the rule 18 of the XPath specification reads UnionExpr ::= PathExpr | UnionExpr '|' PathExpr in its original form. In YAPPS, the left recursion can be replaced as rule UnionExpr: PathExpr UnionExprs rule UnionExprs: # empty | BAR...
...recursively) Abuse class syntax for other things Experiment with automatic type checking Delegation (or acquisition) Dynamic inheritance patterns Automatic caching of methods Credits Many thanks to David Ascher and Donald Beaudry for their comments on earlier draft of this paper. Also thanks to Matt Conway and Tommy Burnette for putting a seed for the idea of metaclasses in my mind, nearly three years ago, even though at the time my response was ``you can do...
...Functions. The Python C API has gained a new type PyInstanceMethod_Type and the functions PyInstanceMethod_Check(o), PyInstanceMethod_New(func) and PyInstanceMethod_Function(im). Constants gc.DEBUG_OBJECT and gc.DEBUG_INSTANCE have been removed from the gc module; gc.DEBUG_COLLECTABLE or gc.DEBUG_UNCOLLECTABLE are now enough to print the corresponding list of objects considered by the garbage collector. Issue #1573: Improper use of the keyword-only syntax makes the parser crash. Issue #1564: The...
...functions themselves are given a reference to the Properties manager so they can recursively request any additionally needed dependencies. To add a new prediction we register the new function in the function table -- and let the functions themselves handle the dependencies. The cache is needed because some properties are expensive to compute or are needed by many other properties. Architecture of the Property Manager Zoom in The resulting new architecture made a simple but profound difference...
...functions and methods as well as functions and methods defined in Python. This attribute is used by pickle.whichmodule(), which changes the behavior of whichmodule slightly. In Python 2.2 whichmodule() returns "__main__" for functions that are not defined at the top-level of a module (examples: methods, nested functions). Now whichmodule() will return the proper module name. Extension modules operator.isNumberType() now checks that the object has a nb_int or nb_float slot, rather...
...functions and algorithms, becomes a single, executable Python script. The GUI and the code are two interchangeable views of the same underlying mathematical model - editing one automatically updates the other. This retains the accessibility and experimental immediacy of a traditional spreadsheet user interface, while allowing the user to tame the spreadsheet's complexity using the same techniques that software engineers have been inventing for the last few decades: elimination of redundancies; f...
If you didn't find what you need, try your search in the Python language documentation.