inicio mail me! sindicaci;ón

Updates from Python SVN, Part 18

IT’s been definitely a while since my last update but having a new job changes a lot my schedule.

  • In the httplib module there was a bug in reading data from the stream. HTTPConnection hanged when reading too much data at once. This has been fixed closing the connection after reading the whole stream.

  • In the decimal module the tuple constructor is now less permissive. It allowed bad coefficient numbers, floats in the sign and other stuff which generated the wrong number or let the algorithms misbehave.

  • mmap() has a new offset parameter to map a window of a file.

  • named_tuple has been renamed to namedtuple.

  • The sum() builtin function has been optimized for integer and floats: it keeps temporary sums in C instead of new Python objects assuming operands are all of the same type. If not, goes back to the default routine.

  • os.environ.pop() and os.environ.clear() now call unsetenv() for a correct behavior.

  • Added support for FreeBSD 8.

  • Added mp4 to mimetypes.py.

  • Various fixes in the bsddb module (like bsddb.dbshelve using the highest pickle protocol and more).

  • Fixed marshal’s incorrect handling of subclasses of builtin types.

  • Added set/frozenset’s isdisjoint(): returns True if two sets have a null intersection.

  • Added getter, setter, deleter methods to properties that can be used as decorators to create fully-populated properties.

[code lang="python"] class C: foo = property(doc=”hello”) @foo.getter def foo(self): return self._foo @foo.setter def foo(self, value): self._foo = abs(value) @foo.deleter def foo(self): del self._foo c = C() assert C.foo.doc == “hello” assert not hasattr(c, “foo”) c.foo = -42 assert c.foo == 42 del c.foo assert not hasattr(c, “foo”) [/code]

[code lang="python"] Python 2.6a0 (trunk:59170M, Nov 24 2007, 15:06:35)

a = “pippoplutarca” a.find(’t', None, None)
8

Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)

a = “pippoplutarca” a.find(’t', None, None) Traceback (most recent call last): File ““, line 1, in TypeError: slice indices must be integers or None or have an index method [/code]

  • Directories and zipfiles containing a _ main _.py file can now be directly executed by passing their name to the interpreter. The directory/zipfile is automatically inserted as the first entry in sys.path.

  • Abstract base classes have been backported to Python 2.6.

  • Python 2.6 is now compilable with Visual Studio 2008.

  • Major change in the internal structure of the Decimal number: now it does not store the mantissa as a tuple of numbers, but as a string. This avoids a lot of conversions, and achieves a speedup of 40%. The API remains intact.

Related posts

  • Updates from Python SVN, Part 12
  • Updates from Python SVN, Part 6
  • Updates from Python SVN, Part 10
  • Updates from Python SVN, Part 11
  • Updates from Python SVN, Part 16
  • Leave a Comment