Python 3.1 beta 1

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Thu May 7 11:57:22 EDT 2009


I appreciate the tables "Infinite Iterators" and "Iterators
terminating on the shortest input sequence" at the top of the
itertools module, they are quite handy. I'd like to see similar
summary tables at the top of other docs pages too (such pages are
often quite long), for example the collections docs page.


collections.Counter and collections.OrderedDict: very nice and useful.
Is the order inside OrderedDict kept with a double linked list of the
items?


Counter.most_common([n]): a good idea.


If I need a dictionary that is both ordered and has a default too I
can't combine their qualities (but I can use the __missing__(key)
hook).


>Equality tests between OrderedDict objects are order-sensitive and are implemented as list(od1.items())==list(od2.items()). Equality tests between OrderedDict objects and other Mapping objects are order-insensitive<

very nice idea.


>The OrderedDict constructor and update() method both accept keyword arguments, but their order is lost because Python's function call semantics pass-in keyword arguments using a regular unordered dictionary.<

This is unfortunate :-(
Well, I'd like function call semantics pass-in keyword arguments to
use OrderedDicts then... :-)


>Several mathematical operations are provided for combining Counter objects to produce multisets<

Very nice.


itertools.count(): when increments are non-integer I hope the results
are computed with a multiplication instead an interated sum, to
increase precision.


Issue 4688 and the work by Antoine Pitrou: interesting GC
optimization. The performance difference of the BinaryTrees benchmark
is big.

Bye,
bearophile



More information about the Python-list mailing list