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.
...ing of very large lists. (PEP 289) reversed() - a new builtin that takes a sequence and returns an iterator that loops over the elements of the sequence in reverse order (PEP 322) new sort() keyword arguments - sort() now accepts 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(), ...
...instance, subclasses should override 'init' instead of __init__ - the __init__ method is called each time the constructor is called. For example: >>> class MySingleton(Singleton): ... def init(self): ... print "calling init" ... def __init__(self): ... print "calling __init__" ... >>> x = MySingleton() calling init calling __init__ >>> assert x.__class__ is MySingleton >>> y = MySingleton() calling __init...
...initialize the subclass instance, subclasses should override 'init' instead of __init__ - the __init__ method is called each time the constructor is called. For example: >>> class MySingleton(Singleton): ... def init(self): ... print "calling init" ... def __init__(self): ... print "calling __init__" ... >>> x = MySingleton() calling init calling __init__ >>> assert x.__class__ is MySingleton >>> y = MySingleton() calling __init__ >>> assert x is y >...
...involved in developing, packaging, building, and installing a module distribution (but not testing or documenting it, which ultimately should also be part of the plan). Note the three kinds of people present in the diagram: developer creator/maintainer of the base source tree packager a) someone (presumably the developer, wearing his "packager" hat) who turns the base source tree into the source distribution; or b) someone (...
...int. We also saw the Software-as-a-Service (SaaS) model being validated by the likes of Salesforce.com and likely to grow in the coming years. So we set out to build the "Everything that you need to run a midsized project in one box" service, combining project data (requirements, issues, etc.), process guidance, and source code management in a single integrated solution. We also had the idea that we could bring simplified, purpose-built Nouvelle Artificial Intelligence (think videogame...
...ing values in ConfigParser. Moved the new string-only restriction added in rev. 1.65 to the SafeConfigParser class, leaving existing ConfigParser & RawConfigParser behavior alone, and documented the conditions under which non-string values work. Build Building on darwin now includes /opt/local/include and /opt/local/lib for building extension modules. This is so as to include software installed as a DarwinPorts port <http://darwinports.opendarwin.org/> pyport.h now defines a Py_I...
...in 2.3a2.) itertools - high speed, memory efficient looping constructs inspired by Haskell and SML. (New in 2.3a2.) (Some improvements in 2.3b1, including subsumption of times() into repeat(), and addition of chain() and cycle().) logging - a flexible, configurable logging package based on log4j and our own PEP 282; written by Vinay Sajip. (New in 2.3a2: warn/WARN renamed to warning/WARNING; logging module actually included in the Windows installer.) optparse - a powerful command line opti...
...ings. int subclasses can be initialized with longs if the value fits in an int. See SF bug #683467. long(string, base) takes time linear in len(string) when base is a power of 2 now. It used to take time quadratic in len(string). filter returns now Unicode results for Unicode arguments. raw_input can now return Unicode objects. List objects' sort() method now accepts None as the comparison function. Passing None is semantically identical to calling sort() with no arguments. Fixed crash when pri...
...in a previous comment. Here are my current comments: New builtin: indexed() I like the idea of having some way to iterate over a sequence and its index set in parallel. It's fine for this to be a builtin. I don't like the name "indexed"; adjectives do not make good function names. Maybe iterindexed()? I don't like the start and stop arguments. If I saw code like for i, j in iterindexed("abcdefghij", 5, 10): print i, j I would expect it to print...
...instance as argument. intobject.h is no longer included by Python.h. The remains were moved to longobject.h. It still exists to define several aliases from PyInt to PyLong functions. Removed sys.maxint, use sys.maxsize instead. Extension Modules The hotshot profiler has been removed; use cProfile instead. Library When loading an external file using testfile(), the passed-in encoding argument was being ignored if __loader__ is defined and forcing the source to be UTF-8. The methods os.tmp...
...inful, even assuming I won, but I dived into the book and read up on Python's metaclass facilities. The resulting function is shown in Listing 3, and the code that calls it is in Listing 4. def copy_instance(toclass, fromdict): # Initialize a class object of given type from a conformant dictionary. class_sig = toclass.__dict__.keys(); class_sig.sort() dict_keys = fromdict.keys(); dict_keys.sort() common = intersect(class_sig, dict_keys) if 'typemap' in class_sig: class_s...
...in their limitations. In addition to the goal of teaching how computers work, a course in computer programming will return to the curriculum an emphasis on logical thought which was once the main benefit of teaching geometry. Two general computing trends of particular interest are the move towards information appliances and the growth of embedded CPUs in everyday machines and appliances--whether in the military or the civilian sector. The decreasing size of computing and the increasing re...
...ind that although there are plenty of feet objects implemented in the past in many other languages, you cannot get access to one. But seeing as Java is so cool, you dont care and go around shooting anything else you can find. —Mark Hammond Legal Issues [Reuters] There are unconfirmed reports that MicroSoft Inc. is considering bringing an intellectual property infringement action against the inventer of the Python programming language claiming that the language documentation infringes o...
If you didn't find what you need, try your search in the Python language documentation.