Python-announce-list
Threads by month
- ----- 2025 -----
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
April 2006
- 55 participants
- 82 discussions
I'm pleased to annouce the first alpha release of nose 0.9, 0.9.0a1.
nose is a test runner built on unittest that provides similar
convienience to py.test, without the magic.
nose 0.9 includes a host of new features, as well as numerous
backwards-incompatible changes to interfaces and implementation. For
this reason, I'm releasing it first as an alpha version.
Thanks to the many folks who have contributed patches and ideas and
made bug reports for the development version of 0.9, especially Mika
Eloranta, Jay Parlar, Kevin Dangoor, Scot Doyle and Philip J.Eby.
Here's a quick rundown of what's new in 0.9.0a1.
- Plugins
The most important new feature is support for plugins using
setuptools entrypoints. nose plugins can select and load tests (like
the builtin doctest plugin), reject tests (like the builtin attrib
plugin, contributed by Mika Eloranta, that allows users to select tests
by attribute), watch and report on tests (like the builtin coverage and
profiler plugins), completely replace test result output (like the html
result plugin in the examples directory) or any combination of the
above. Writing plugins is simple: subclass nose.plugins.Plugin and
implement any of the methods in nose.plugins.IPluginInterface.
- Better compatibility with unittest
Test loading has been consolidated into a test loader class that is
drop-in compatible with unittest.TestLoader. Likewise test result
output, including output capture, assert introspection, and support for
skipped and deprecated tests, in nose.result.TextTestResult. If you
want those features and not the rest of nose, you can use just those
classes. nose.main() has also been rewritten to have the same signature
as unittest.main().
- Better command line interface
Command line test selection is more intuitive and powerful, enabling
easy and correct running of single tests while ensuring that fixtures
(setup and teardown) are correctly executed at all levels. No more -f
-m or -o options; now simply specify the tests to run:
nosetests this/file.py that.module
Tests may be specified down to the callable:
nosetests this/file.py:TestClass that.module:this_test
nosetests that.module:TestClass.test_method
There are also new options for dropping into pdb on errors or
failures, and stopping the test run on the first error or failure
(thanks to Kevin Dangoor for the idea).
- More!
Helpful test decorators and functions in nose.tools. Support for
generators in test classes. Better import path handling -- that you can
shut off! Detailed verbose logging using the logging package. And
more...
For more information, installation instructions, etc, see:
http://somethingaboutorange.com/mrl/projects/nose/
1
0
Hi,
this is to inform you of the release of eric3 3.9.0. This version
includes support for Qt4 and PyQt4. It will be the last major release in
the eric3 line of development. From now on the development effort will
concentrate on eric4, the PyQt4 variant of the IDE. As usual the release
is available via
http://www.die-offenbachs.de/detlev/eric3.html
Eric3 is a Python and Ruby IDE with all batteries included.
Regards,
Detlev
--
Detlev Offenbach
detlev(a)die-offenbachs.de
1
0
`ConfigObj 4.3.1 <http://www.voidspace.org.uk/python/configobj.html>`_
and `validate 0.2.2
<http://www.voidspace.org.uk/python/validate.html>`_ are now available.
These are both minor bugfix/feature enhancement releases.
What is New in ConfigObj ?
Changes since **ConfigObj** 4.3.0 :
* Added ``validate.py`` back into ``configobj.zip``. (Thanks to Stewart
Midwinter)
* Updated to `validate.py`_ 0.2.2.
* Preserve tuples when calling the ``dict`` method. (Thanks to Gustavo
Niemeyer.)
* Changed ``__repr__`` to return a string that contains ``ConfigObj({
... })``.
* Change so that an options dictionary isn't modified by passing it to
ConfigObj. (Thanks to Artarious.)
* Added ability to handle negative integers in ``unrepr``. (Thanks to
Kevin Dangoor.)
What is New in validate ?
Changes since **validate** 0.2.1 :
* Addressed bug where a string would pass the ``is_list`` test. (Thanks
to Konrad Wojas.)
What is ConfigObj ?
**ConfigObj** is a simple but powerful config file reader and writer:
an *ini file round tripper*. Its main feature is that it is very easy
to use, with a straightforward programmer's interface and a simple
syntax for config files. It has lots of other features though :
* Nested sections (subsections), to any level
* List values
* Multiple line values
* String interpolation (substitution)
* Integrated with a powerful validation system
- including automatic type checking/conversion
- repeated sections
- and allowing default values
* All comments in the file are preserved
* The order of keys/sections is preserved
* No external dependencies
* Full Unicode support
* A powerful ``unrepr`` mode for storing basic datatypes
What is validate ?
`validate.py <http://www.voidspace.org.uk/python/validate.html>`_ is a
module for validating values against a specification. It can be used
with **ConfigObj**, or as a standalone module.
It is extensible, and as well as doing type conversion from strings,
you can easily implement your own functions for transforming values in
any way you please.
1
0
Riverbank Computing is pleased to announce the release of PyQt v4.0beta1
available from http://www.riverbankcomputing.co.uk/pyqt/.
PyQt is a comprehensive set of Qt bindings for the Python programming language
and supports the same platforms as Qt (Windows, Linux and MacOS/X). Like Qt,
PyQt is available under the GPL and a commercial license.
PyQt v4 supports Qt v4 (http://www.trolltech.com/products/qt/index.html).
PyQt v3 is still available to support earlier versions of Qt.
PyQt v4 is implemented as a set of 8 extension modules containing
approximately 400 classes and 6,000 functions and methods.
QtCore
The non-GUI infrastructure including event loops, threads, i8n, Unicode,
signals and slots, user and application settings.
QtGui
A rich collection of GUI widgets.
QtNetwork
A set of classes to support TCP and UDP socket programming and higher
level protocols (eg. HTTP).
QtOpenGL
A set of classes that allows PyOpenGL to render onto Qt widgets.
QtSql
A set of classes that implement SQL data models and interfaces to industry
standard databases. Includes an implementation of SQLite.
QtSvg
A set of classes to render SVG files onto Qt widgets.
QtXML
A set of classes that implement DOM and SAX parsers.
QtAssistant
A set of classes that enables the Qt Assistant online help browser to be
integrated with an application.
A Windows installer is provided for the GPL version of PyQt to be used with
the GPL version of Qt v4 (http://www.trolltech.com/download/qt/windows.html).
It enabes a complete PyQt environment to be installed on Windows without the
need for a C++ compiler.
PyQt includes the pyuic utility which generates Python code to implement user
interfaces created with Qt Designer in the same way that the uic utility
generates C++ code. It is also able to load Designer XML files dynamically.
1
0

April 29, 2006
python-dev Summary for 2006-03-01 through 2006-03-15
++++++++++++++++++++++++++++++++++++++++++++++++++++
.. contents::
[The HTML version of this Summary is available at
http://www.python.org/dev/summary/2006-03-01_2006-03-15]
=============
Announcements
=============
-----------------------
Webstats for python.org
-----------------------
Thomas Wouters set up webalizer on dinsdale.python.org and added
webstats for all subsites of python.org:
* http://www.python.org/webstats/
* http://beta.python.org/webstats/
* http://bugs.python.org/webstats/
* http://planet.python.org/webstats/
* http://docs.python.org/webstats/
* http://svn.python.org/webstats/
Check 'em out if you're interested!
Contributing thread:
- `Webstats for www.python.org et al.
<http://mail.python.org/pipermail/python-dev/2006-March/061930.html>`__
[SJB]
---------------------------
Python 2.5 release schedule
---------------------------
The first releases scheduled for Python 2.5 are quickly approaching.
Check `PEP 356`_ for details, but the first alpha is due on April 1st.
.. _PEP 356: http://www.python.org/doc/peps/pep-0356/
Contributing thread:
- `2.5 release schedule?
<http://mail.python.org/pipermail/python-dev/2006-March/062185.html>`__
[SJB]
-----------
Py3K branch
-----------
Guido has begun work on Py3K, starting a new branch to rip out some
stuff like string exceptions and classic classes. He's trying to get
a "feel" for what Python 3.0 will look like, hopefully before his
keynote in OSCON.
Contributing thread:
- `Py3k branch - please stay out :-)
<http://mail.python.org/pipermail/python-dev/2006-March/062396.html>`__
[SJB]
-------------------------------------------
Deprecated modules going away in Python 2.5
-------------------------------------------
A number of deprecated modules will be removed in Python 2.5, including:
* reconvert.py
* regex (regexmodule.c)
* regex_syntax.py
* regsub.py
and a variety of things from lib-old. These modules have been
deprecated for a while now, and will be pulled in the next Python
release.
Contributing thread:
- `Deprecated modules going away in 2.5
<http://mail.python.org/pipermail/python-dev/2006-March/062405.html>`__
[SJB]
=========
Summaries
=========
-------------------------------
Maintaining ctypes in SVN trunk
-------------------------------
Thomas Heller put ctypes into the Python SVN repository, and with the
help of perky, Neal Norwitz and Thomas Wouters, updated it to take
advantage of the new ssize_t feature. The "official" ctypes
development will remain in its Sourceforge repository at least for a
while since this makes it easy to test ctypes on the SF compile farm.
Contributing threads:
- `ctypes is in SVN now.
<http://mail.python.org/pipermail/python-dev/2006-March/062211.html>`__
- `Developing/patching ctypes (was: Re: integrating ctypes into
python) <http://mail.python.org/pipermail/python-dev/2006-March/062243.html>`__
- `Developing/patching ctypes
<http://mail.python.org/pipermail/python-dev/2006-March/062244.html>`__
[SJB]
-----------------
Windows buildbots
-----------------
Josiah Carlson had been working on getting a buildbot slave running on
a Windows box, but eventually gave up due to crashes caused by VS.NET.
Tim Peters fought his way through the setup with a XP box, posting
`his lessons`_ to the wiki, and Trent Mick managed to follow a similar
route and setup a Win2K buildbot slave. Thanks to all who suffered
through the config -- Windows buildbot coverage looks pretty good now!
.. _his lessons: http://wiki.python.org/moin/BuildbotOnWindows
Contributing threads:
- `Another Windows buildbot slave
<http://mail.python.org/pipermail/python-dev/2006-March/062068.html>`__
- `Still looking for volunteer to run Windows buildbot
<http://mail.python.org/pipermail/python-dev/2006-March/062267.html>`__
[SJB]
-----------------------------------
Python 3.0: itr.next() or next(itr)
-----------------------------------
The end of last fortnight's defaultdict thread turned to discussing
the fate of the iterator protocol's .next() method in Python 3.0.
Greg Ewing argued that renaming .next() to .__next__() and introducing
a builtin function next() would be more consistent with the other
magic methods and also more future-proof, since the next() function
could be modified if the protocol method needed to change. Raymond
Hettinger was very strongly against this proposal, suggesting that
trading a Python-level attribute lookup for a Python-level global
lookup plus a C-level slot lookup was not a good tradeoff.
The discussion then spread out to other protocol method/function pairs
-- e.g. len() and __len__() -- and Oleg Broytmann suggested that they
could all be replaced with methods, thus saving a lookup and clearing
out the builtin namespace. Neil Schemenauer and Michael Chermside
argued against such a change, saying that the double-underscore
pattern allows new special methods to be introduced without worrying
about breaking user code, and that using functions for protocols
forces developers to use the same names when the protocols are
involved, while using methods could allow some developers to choose
different names than others.
Guido indicated that he'd like to do some usability studies to
determine whether methods or functions were more intuitive for the
various protocols.
Contributing threads:
- `defaultdict and on_missing()
<http://mail.python.org/pipermail/python-dev/2006-March/061913.html>`__
- `iterator API in Py3.0
<http://mail.python.org/pipermail/python-dev/2006-March/061927.html>`__
- `iterator API in Py3.
<http://mail.python.org/pipermail/python-dev/2006-March/061977.html>`__
- `.len() instead of __len__() (was: iterator API in Py3.0)
<http://mail.python.org/pipermail/python-dev/2006-March/062072.html>`__
- `x.len() instead of len(x) in Py3.0
<http://mail.python.org/pipermail/python-dev/2006-March/062079.html>`__
- `.len() instead of __len__() (was: iterator API inPy3.0)
<http://mail.python.org/pipermail/python-dev/2006-March/062085.html>`__
- `.len() instead of __len__() in Py3.0
<http://mail.python.org/pipermail/python-dev/2006-March/062086.html>`__
[SJB]
---------------------------
Python 3.0: base64 encoding
---------------------------
This fortnight continued discussion from the last as to whether the
base64 encoding should produce unicode or bytes objects. The encoding
is specified in `RFC 2045`_ as "designed to represent arbitrary
sequences of octets" using "a 65-character subset of US-ASCII".
Traditionally, base64 "encoding" goes from bytes to characters, and
base64 "decoding" goes from characters to bytes. But this is the
inverse of the usual unicode meanings, where "encoding" goes from
characters to bytes, and where "decoding" goes from bytes to
characters.
Thus some people felt that the recent proposal to have only
bytes.decode(), which would produce unicode, and unicode.encode(),
which would produce bytes, would be a major problem for encodings like
base64 which used the opposite terminology. A variety of proposals
ensued, including putting .encode() and .decode() on both bytes and
strings, having encode() and decode() builtins, and various ways of
putting encoding and decoding into the unicode and bytes constructors
or classmethods.
No clear solution could be agreed upon at the time.
.. _RFC 2045: http://www.ietf.org/rfc/rfc2045.txt
Contributing thread:
- `bytes.from_hex()
<http://mail.python.org/pipermail/python-dev/2006-March/061914.html>`__
[SJB]
-----------------------------
Coverity scans of Python code
-----------------------------
Ben Chelf of Coverity presented scan.coverity.com, which provides the
results of some static source code analysis looking for a variety of
code defects in a variety of open source projects, including Python.
Full access to the reports is limited to core developers, but Neal
Norwitz explained a bit what had been made available. The types of
problems reported in Python include unintialized variables, resource
leak, negative return values, using a NULL pointer, dead code, use
after free and some other similar conditions. The reports provide
information about what condition is violated and where, and according
to Neal have been high quality and accurate, though of course there
were some false positives. Generally, developers seemed quite happy
with the reports, and a number of bugs have subsequently been fixed.
Contributing threads:
- `Coverity Open Source Defect Scan of Python
<http://mail.python.org/pipermail/python-dev/2006-March/062088.html>`__
- `About "Coverity Study Ranks LAMP Code Quality"
<http://mail.python.org/pipermail/python-dev/2006-March/062322.html>`__
- `Coverity report
<http://mail.python.org/pipermail/python-dev/2006-March/062434.html>`__
[SJB]
-------------------------------
Speeding up lookups of builtins
-------------------------------
Steven Elliott was looking into reducing the cost of looking up Python
builtins. Two PEPs (`PEP 280`_ and `PEP 329`_) had already been
proposed for similar purposes, but Steven felt these were biting off
too much at once as they tried to optimize all global attribute
lookups instead of just those of builtins. His proposal would replace
the global-builtin lookup chain with an array that indexed the
builtins. A fast check for builtin shadowing would be performed before
using a builtin; if no shadowing existed, the builtin would simply be
extracted from the array, and if shadowing was present, the longer
lookup sequence would be followed.
Guido indicated that he would like to be able to assume that builtins
are not shadowed in Python 3.0, but made no comment on the particular
implementation strategy suggested. Steven Elliott promised a PEP,
though it was not yet available at the time of this summary.
.. _PEP 280: http://www.python.org/doc/peps/pep-0280/
.. _PEP 329: http://www.python.org/doc/peps/pep-0329/
Contributing thread:
- `Making builtins more efficient
<http://mail.python.org/pipermail/python-dev/2006-March/062200.html>`__
[SJB]
-------------------------------------------------
Requiring parentheses for conditional expressions
-------------------------------------------------
Upon seeing a recent checkin using conditional expressions, Jim Jewett
suggested that parentheses should be required around all conditional
expressions for the sake of readability. The usual syntax debate
ensued, and in the end it looked like the most likely result was that
`PEP 8`_ would be updated to suggest parentheses around the "test"
part of the conditional expression if it contained any internal
whitespace.
.. _PEP 8: http://www.python.org/doc/peps/pep-0008/
Contributing threads:
- `conditional expressions - add parens?
<http://mail.python.org/pipermail/python-dev/2006-March/062089.html>`__
- `(no subject)
<http://mail.python.org/pipermail/python-dev/2006-March/062101.html>`__
[SJB]
-----------------------------
Exposing a global thread lock
-----------------------------
Raymond Hettinger suggested exposing the global interpreter lock to
allow code to temporarily suspend all thread switching. Guido was
strongly against the idea as it was not portable to Jython or
IronPython and it was likely to cause deadlocks. However, there was
some support for it, and others indicated that the only way it could
cause deadlocks is if locks were acquired within the sections where
thread switching was disabled, and that even these could be avoided by
having locks raise an exception if acquired in such a section.
However, Michael Chermside explained that supporting such a thing in
Jython and IronPython would really be impossible, and suggested that
the functionality be made available in an extension module instead.
Raymond Hettinger then suggested modifying sys.setcheckinterval() to
allow thread switching to be stopped, but Martin v. Löwis explained
that even disabling this "release the GIL from time to time" setting
would not disable thread switching as, for example, the file_write
call inside a PRINT_* opcode releases the GIL around fwrite
regardless.
Contributing thread:
- `Threading idea -- exposing a global thread lock
<http://mail.python.org/pipermail/python-dev/2006-March/062346.html>`__
[SJB]
-----------------------------
Making quit and exit callable
-----------------------------
Ian Bicking resuscitated a previous proposal to make ``quit`` and
``exit`` callable objects with informative __repr__ messages like
``license`` and ``help`` already have. Georg Brandl submitted a patch
that makes ``quit`` and ``exit`` essentially synonymous with
``sys.exit`` but with better __repr__ messages. The patch was
accepted and should appear in Python 2.5.
Contributing thread:
- `quit() on the prompt
<http://mail.python.org/pipermail/python-dev/2006-March/062156.html>`__
[SJB]
---------------------
Python 3.0: Using C++
---------------------
Fredrik Lundh suggested that in Python 3.0 it might be useful to
switch to C++ instead of C for Python's implementation. This would
allow some additional type checking, some more reliable reference
counting with local variable destructors and smart pointers, and
"native" exception handling. However, it would likely make linking and
writing extension modules more difficult as C++ does not interoperate
with others as happily as C does. Stephen J. Turnbull suggested that
it might also be worth considering following the route of XEmacs --
all code must compile without warnings under both C and C++.
No final decision was made, but for the moment it looks like Python
will stick with the status quo.
Contributing thread:
- `C++ for CPython 3? (Re: str.count is slow)
<http://mail.python.org/pipermail/python-dev/2006-March/061920.html>`__
[SJB]
----------------------
A @decorator decorator
----------------------
Georg Brandl presented a `patch providing a ``decorator`` decorator`_
that would transfer a function's __name__, __doc__ and __dict__
attributes to the wrapped function. Initially, he had placed it in a
new ``decorator`` module, but a number of folks suggested that this
module and the ``functional`` module -- which currently only contains
partial() -- should be merged into a ``functools`` module. At the time
of this summary, the patch had not been applied.
.. _patch providing a ``decorator`` decorator: http://bugs.python.org/1448297
Contributing thread:
- `decorator module patch
<http://mail.python.org/pipermail/python-dev/2006-March/062290.html>`__
[SJB]
-----------------------
Expanding the use of as
-----------------------
Georg Brandl proposed that since ``as`` is finally becoming a keyword,
other statements might allow ``as`` to be used for binding a name like
the ``import`` and ``with`` statements do now. Generally people
thought that using ``as`` to name the ``while`` or ``if`` conditions
was not really that useful, especially since the parallel to ``with``
statements was pretty weak -- ``with`` statements bind the result of
the context manager's __enter__() call, not the context manager
itself.
Contributing thread:
- `"as" mania
<http://mail.python.org/pipermail/python-dev/2006-March/062128.html>`__
[SJB]
------------------------------
Relative imports in the stdlib
------------------------------
Guido made a checkin using the new `relative import feature`_ in a few
places. Because using relative imports can cause custom __import__'s
to break (because they don't take the new optional fifth argument),
Guido backed out the changes, and updated `PEP 8`_ to indicate that
absolute imports were to be preferred over relative imports whenever
possible.
.. _relative import feature: http://www.python.org/doc/peps/pep-0328/
Contributing threads:
- `Using relative imports in std lib packages ([Python-checkins]
r43033 - in python/trunk/Lib: distutils/sysconfig.py
encodings/__init__.py)
<http://mail.python.org/pipermail/python-dev/2006-March/062421.html>`__
- `[Python-checkins] r43033 - in python/trunk/Lib:
distutils/sysconfig.py encodings/__init__.py
<http://mail.python.org/pipermail/python-dev/2006-March/062427.html>`__
[SJB]
------------------------------------
Making staticmethod objects callable
------------------------------------
Nicolas Fleury suggested that staticmethod objects should be made
callable so that code like::
class A(object):
@staticmethod
def foo(): pass
bar = foo()
would work instead of compaining that staticmethod objects are not
callable. Generally, people seemed to feel that most uses of
staticmethods were better expressed as module-level functions anyway,
and so catering to odd uses of staticmethods was not something Python
needed to do.
Contributing thread:
- `Making staticmethod objects callable?
<http://mail.python.org/pipermail/python-dev/2006-March/061948.html>`__
[SJB]
----------------------------------
Adding a uuid module to the stdlib
----------------------------------
Fredrik Lundh suggested `adding Ka-Ping Yee's uuid module`_ to the
standard library. Most people were agreeable to the idea, but with
other uuid implementations around, there was some discussion about the
details. Phillip J. Eby suggested something more along the lines of
`PEAK's uuid module`_, but no final decisions were made.
.. _adding Ka-Ping Yee's uuid module: http://bugs.python.org/1368955
.. _PEAK's uuid module:
http://svn.eby-sarna.com/PEAK/src/peak/util/uuid.py?view=markup
Contributing thread:
- `how about adding ping's uuid module to the standard lib ?
<http://mail.python.org/pipermail/python-dev/2006-March/062119.html>`__
[SJB]
-------------------------------
A dict that takes key= callable
-------------------------------
Neil Schemenauer suggested providing dict variants in the collections
module that would use the ids of the objects instead of the objects
themselves. Guido suggested that it would likely be more useful to
design a dict variant that took a key= argument like list.sort() does,
and apply that key function to all keys in the dict. That would make
implementing Neil's id-dict almost trivial and support a variety of
other use-cases, like case-insensitive dicts. People seemed quite
supportive of the proposal, but no patch was available at the time of
this summary.
Contributing thread:
- `collections.idset and collections.iddict?
<http://mail.python.org/pipermail/python-dev/2006-March/062100.html>`__
[SJB]
----------------------------
Bug in __future__ processing
----------------------------
Martin Maly found `Guido's previously encountered bug`_ that Python
2.2 through 2.4 allows some assignment statements before the
``__future__`` import. Tim Peters correctly channeled Guido that this
was a bug and would be fixed in Python 2.5.
.. _Guido's previously encountered bug:
http://mail.python.org/pipermail/python-dev/2006-January/060247.html
Contributing thread:
- `Bug in from __future__ processing?
<http://mail.python.org/pipermail/python-dev/2006-March/062047.html>`__
[SJB]
-----------------------
Cleaning up string code
-----------------------
Chris Perkins noted that ``str.count()`` is substantially slower than
``unicode.count()``. Ben Cartwright and others indicated that the
source for these functions showed clearly that the unicode version had
been better optimized. Fredrik Lundh and Armin Rigo both mentioned
cleaning up the string code to avoid some of the duplication and
potentially to merge the str and unicode implementations together. At
the time of this summary, it didn't seem that any progress towards
this goal had yet been made.
Contributing thread:
- `str.count is slow
<http://mail.python.org/pipermail/python-dev/2006-February/061885.html>`__
- `str.count is slow
<http://mail.python.org/pipermail/python-dev/2006-March/061915.html>`__
[SJB]
---------------------------------------------
Freeing Python-allocated memory to the system
---------------------------------------------
Tim Peters spent his PyCon time working on `a patch by Evan Jones`_,
originally `discussed in January`_. The patch enables Python to free
memory back to the operating system so that code like::
x = []
for i in xrange(1000000):
x.append([])
del x[:]
does not continue to consume massive memory after the del statement.
Tim gave python-devvers some time to review the patch for any speed or
other issues, and then committed it.
.. _a patch by Evan Jones: http://bugs.python.org/1123430
.. _discussed in January:
http://mail.python.org/pipermail/python-dev/2005-January/051255.html
Contributing thread:
- `Arena-freeing obmalloc ready for testing
<http://mail.python.org/pipermail/python-dev/2006-March/061991.html>`__
[SJB]
------------------------------------------
Modifying the context manager __exit__ API
------------------------------------------
After thinking things over, Guido decided that the context manager
``__exit__`` method should be required to return True if it wants to
suppress an exception. This addressed the main concerns about the
previous API, that if ``__exit__`` methods were required to reraise
exceptions, a lot of ``__exit__`` methods might end up with
easily-missed bugs.
Contributing thread:
- `__exit__ API?
<http://mail.python.org/pipermail/python-dev/2006-March/062050.html>`__
[SJB]
-------------------------------
Python 3.0: default comparisons
-------------------------------
In Python 3.0, Guido plans to ditch the default ``< <= > >=``
comparisons currently provided, and only provide ``== !=`` where by
default all objects compare as unequal.
Contributing thread:
- `Keep default comparisons - or add a second set?
<http://mail.python.org/pipermail/python-dev/2006-March/062404.html>`__
[SJB]
================
Deferred Threads
================
- `[Python-checkins] r43041 - python/trunk/Modules/_ctypes/cfield.c
<http://mail.python.org/pipermail/python-dev/2006-March/062416.html>`__
==================
Previous Summaries
==================
- `Proposal: defaultdict
<http://mail.python.org/pipermail/python-dev/2006-March/061945.html>`__
===============
Skipped Threads
===============
- `New test failure on Windows
<http://mail.python.org/pipermail/python-dev/2006-March/061928.html>`__
- `.py and .txt files missing svn:eol-style in trunk
<http://mail.python.org/pipermail/python-dev/2006-March/061929.html>`__
- `Using and binding relative names (was Re: PEP forBetter Control of
Nested Lexical Scopes)
<http://mail.python.org/pipermail/python-dev/2006-March/061934.html>`__
- `Stateful codecs [Was: str object going in Py3K]
<http://mail.python.org/pipermail/python-dev/2006-March/061946.html>`__
- `bytes thoughts
<http://mail.python.org/pipermail/python-dev/2006-March/061966.html>`__
- `wiki as scratchpad
<http://mail.python.org/pipermail/python-dev/2006-March/061967.html>`__
- `test_compiler failure
<http://mail.python.org/pipermail/python-dev/2006-March/061970.html>`__
- `DRAFT: python-dev Summary for 2006-01-16 through 2005-01-31
<http://mail.python.org/pipermail/python-dev/2006-March/061986.html>`__
- `Weekly Python Patch/Bug Summary
<http://mail.python.org/pipermail/python-dev/2006-March/061987.html>`__
- `When will regex really go away?
<http://mail.python.org/pipermail/python-dev/2006-March/061988.html>`__
- `ref leak w/except hooks
<http://mail.python.org/pipermail/python-dev/2006-March/061995.html>`__
- `Faster list comprehensions
<http://mail.python.org/pipermail/python-dev/2006-March/062030.html>`__
- `PEP 357 <http://mail.python.org/pipermail/python-dev/2006-March/062032.html>`__
- `Lib/test/test_compiler.py fails
<http://mail.python.org/pipermail/python-dev/2006-March/062035.html>`__
- `FrOSCon 2006 - Call for {Papers|Projects}
<http://mail.python.org/pipermail/python-dev/2006-March/062057.html>`__
- `Outdated Python Info on www.unicode.org (fwd)
<http://mail.python.org/pipermail/python-dev/2006-March/062058.html>`__
- `My buildbot host upgraded to OSX 10.4
<http://mail.python.org/pipermail/python-dev/2006-March/062059.html>`__
- `Slightly OT: Replying to posts
<http://mail.python.org/pipermail/python-dev/2006-March/062074.html>`__
- `New Future Keywords
<http://mail.python.org/pipermail/python-dev/2006-March/062080.html>`__
- `[Python-checkins] Python Regression Test Failures refleak (1)
<http://mail.python.org/pipermail/python-dev/2006-March/062082.html>`__
- `[Python-checkins] Python humor
<http://mail.python.org/pipermail/python-dev/2006-March/062090.html>`__
- `Two gcmodule patches
<http://mail.python.org/pipermail/python-dev/2006-March/062105.html>`__
- `Scientific Survey: Working Conditions in Open Source Projects
<http://mail.python.org/pipermail/python-dev/2006-March/062134.html>`__
- `_bsddb.c ownership
<http://mail.python.org/pipermail/python-dev/2006-March/062137.html>`__
- `str(Exception) changed, is that intended?
<http://mail.python.org/pipermail/python-dev/2006-March/062149.html>`__
- `Long-time shy failure in test_socket_ssl
<http://mail.python.org/pipermail/python-dev/2006-March/062173.html>`__
- `mail.python.org disruption
<http://mail.python.org/pipermail/python-dev/2006-March/062175.html>`__
- `Bug Day? <http://mail.python.org/pipermail/python-dev/2006-March/062191.html>`__
- `Generated code in test_ast.py
<http://mail.python.org/pipermail/python-dev/2006-March/062197.html>`__
- `fixing log messages
<http://mail.python.org/pipermail/python-dev/2006-March/062202.html>`__
- `[Python-checkins] r42929 - python/trunk/Tools/scripts/svneol.py
<http://mail.python.org/pipermail/python-dev/2006-March/062224.html>`__
- `unicodedata.c no longer compiles on Windows
<http://mail.python.org/pipermail/python-dev/2006-March/062241.html>`__
- `multidict API
<http://mail.python.org/pipermail/python-dev/2006-March/062250.html>`__
- `Google ads on python.org?
<http://mail.python.org/pipermail/python-dev/2006-March/062276.html>`__
- `libbzip2 version?
<http://mail.python.org/pipermail/python-dev/2006-March/062287.html>`__
- `PythonCore\CurrentVersion
<http://mail.python.org/pipermail/python-dev/2006-March/062297.html>`__
- `Strange behavior in Python 2.5a0 (trunk) --- possible error in AST?
<http://mail.python.org/pipermail/python-dev/2006-March/062318.html>`__
- `Why are so many built-in types inheritable?
<http://mail.python.org/pipermail/python-dev/2006-March/062334.html>`__
- `checkin r43015
<http://mail.python.org/pipermail/python-dev/2006-March/062342.html>`__
- `Topic suggestions from the PyCon feedback
<http://mail.python.org/pipermail/python-dev/2006-March/062345.html>`__
- `Another threading idea
<http://mail.python.org/pipermail/python-dev/2006-March/062383.html>`__
- `Octal literals
<http://mail.python.org/pipermail/python-dev/2006-March/062400.html>`__
- `[Python-checkins] r43022 - in python/trunk: Modules/xxmodule.c
Objects/object.c
<http://mail.python.org/pipermail/python-dev/2006-March/062407.html>`__
- `[Python-checkins] Python Regression Test Failuresrefleak (1)
<http://mail.python.org/pipermail/python-dev/2006-March/062409.html>`__
- `[Python-checkins] r43028 - python/trunk/Modules/_ctypes/cfield.c
<http://mail.python.org/pipermail/python-dev/2006-March/062413.html>`__
- `PEP 338 implemented in SVN
<http://mail.python.org/pipermail/python-dev/2006-March/062422.html>`__
========
Epilogue
========
This is a summary of traffic on the `python-dev mailing list`_ from
March 01, 2006 through March 15, 2006.
It is intended to inform the wider Python community of on-going
developments on the list on a semi-monthly basis. An archive_ of
previous summaries is available online.
An `RSS feed`_ of the titles of the summaries is available.
You can also watch comp.lang.python or comp.lang.python.announce for
new summaries (or through their email gateways of python-list or
python-announce, respectively, as found at http://mail.python.org).
This python-dev summary is the 15th written by
the python-dev summary pair of Steve Bethard and Tony Meyer (some day
we'll really catch up).
To contact us, please send email:
- Steve Bethard (steven.bethard at gmail.com)
- Tony Meyer (tony.meyer at gmail.com)
Do *not* post to comp.lang.python if you wish to reach us.
The `Python Software Foundation`_ is the non-profit organization that
holds the intellectual property for Python. It also tries to advance
the development and use of Python. If you find the python-dev Summary
helpful please consider making a donation. You can make a donation at
http://python.org/psf/donations.html . Every cent counts so even a
small donation with a credit card, check, or by PayPal helps.
--------------------
Commenting on Topics
--------------------
To comment on anything mentioned here, just post to
`comp.lang.python`_ (or email python-list(a)python.org which is a
gateway to the newsgroup) with a subject line mentioning what you are
discussing. All python-dev members are interested in seeing ideas
discussed by the community, so don't hesitate to take a stance on
something. And if all of this really interests you then get involved
and join `python-dev`_!
-------------------------
How to Read the Summaries
-------------------------
That this summary is written using reStructuredText_. Any unfamiliar
punctuation is probably markup for reST_ (otherwise it is probably
regular expression syntax or a typo :); you can safely ignore it. We
do suggest learning reST, though; it's simple and is accepted for
`PEP markup`_ and can be turned into many different formats like HTML
and LaTeX. Unfortunately, even though reST is standardized, the
wonders of programs that like to reformat text do not allow us to
guarantee you will be able to run the text version of this summary
through Docutils_ as-is unless it is from the `original text file`_.
.. _python-dev: http://www.python.org/dev/
.. _SourceForge: http://sourceforge.net/tracker/?group_id=5470
.. _python-dev mailing list: http://mail.python.org/mailman/listinfo/python-dev
.. _c.l.py:
.. _comp.lang.python: http://groups.google.com/groups?q=comp.lang.python
.. _PEP Markup: http://www.python.org/peps/pep-0012.html
.. _Docutils: http://docutils.sf.net/
.. _reST:
.. _reStructuredText: http://docutils.sf.net/rst.html
.. _PSF:
.. _Python Software Foundation: http://python.org/psf/
.. _original text file:
http://www.python.org/dev/summary/2006-03-01_2006-03-15.rst
.. _archive: http://www.python.org/dev/summary/
.. _RSS feed: http://www.python.org/dev/summary/channews.rdf
1
0

April 29, 2006
python-dev Summary for 2006-02-16 through 2006-02-28
++++++++++++++++++++++++++++++++++++++++++++++++++++
.. contents::
[The HTML version of this Summary is available at
http://www.python.org/dev/summary/2006-02-16_2006-02-28]
=============
Announcements
=============
-----------------------
Python release schedule
-----------------------
The Python 2.5 release schedule is `PEP 356`_. The first releases are
planned for the end of March/beginning of April. Check the PEP for the
full plan of features.
.. _PEP 356: http://www.python.org/dev/peps/pep-0356/
Contributing threads:
- `2.5 PEP <http://mail.python.org/pipermail/python-dev/2006-February/061110.html>`__
- `2.5 release schedule
<http://mail.python.org/pipermail/python-dev/2006-February/061249.html>`__
- `2.4.3 for end of March?
<http://mail.python.org/pipermail/python-dev/2006-February/061901.html>`__
[SJB]
---------------------
Buildbot improvements
---------------------
Thanks to Benji York and Walter Dörwald, the `buildbot results page`_
now has a new CSS stylesheet that should make it a little easier to
read. (And thanks to Josiah Carlson, we should now have a Windows
buildbot slave.)
.. _buildbot results page: http://www.python.org/dev/buildbot/
Contributing threads:
- `buildbot is all green
<http://mail.python.org/pipermail/python-dev/2006-February/061399.html>`__
- `buildbot vs. Windows
<http://mail.python.org/pipermail/python-dev/2006-February/061554.html>`__
[SJB]
-------------------------------
Deprecation of multifile module
-------------------------------
The multifile module, which has been supplanted by the email module
since Python 2.2, is finally being deprecated. Though the module will
not be removed in Python 2.5, its documentation now clearly indicates
the deprecation.
Contributing thread:
- `Deprecate \`\`multifile\`\`?
<http://mail.python.org/pipermail/python-dev/2006-February/061211.html>`__
[SJB]
------------------------------
Win64 AMD64 binaries available
------------------------------
Martin v. Löwis has made `AMD64 binaries`_ available for the current
trunk's Python. If you're using an AMD64 machine (a.k.a. EM64T or
x64), give 'em a whirl and see how they work.
.. _amd64 binaries: http://www.dcl.hpi.uni-potsdam.de/home/loewis/
Contributing thread:
- `Win64 AMD64 (aka x64) binaries available64
<http://mail.python.org/pipermail/python-dev/2006-February/061533.html>`__
[SJB]
---------------------------------------------------
Javascript to adopt Python iterators and generators
---------------------------------------------------
On a slightly off-topic note, Brendan Eich has blogged_ that the next
version of Javascript will borrow iterators, generators and list
comprehensions from Python. Nice to see that the Python plague is
even spreading to other programming languages now. ;)
.. _blogged: http://weblogs.mozillazine.org/roadmap/archives/2006/02/
Contributing thread:
- `javascript "standing on Python's shoulders" as it moves
forward. <http://mail.python.org/pipermail/python-dev/2006-February/061472.html>`__
[SJB]
=========
Summaries
=========
---------------------------
A dict with a default value
---------------------------
Guido suggested a defaultdict type which would act like a dict, but
produce a default value when __getitem__ was called and no key
existed. The intent was to simplify code examples like::
# a dict of lists
for x in y:
d.setdefault(key, []).append(value)
# a dict of counts
for x in y:
d[key] = d.get(key, 0) + 1
where the user clearly wants to associate a single default with the
dict, but has no simple way to spell this. People quickly agreed that
the default should be specified as a function so that using ``list``
as a default could create a dict of lists, and using ``int`` as a
default could create a dict of counts.
Then the real thread began. Guido proposed adding an ``on_missing``
method to the dict API, which would be called whenever ``__getitem__``
found that the requested key was not present in the dict. The
``on_missing`` method would look for a ``default_factory`` attribute,
and try to call it if it was set, or raise a KeyError if it was not.
This would allow e.g. ``dd.default_factory = list`` to make a dict
object produce empty lists as default values, and ``del
dd.default_factory`` to revert the dict object to the standard
behavior.
However, a number of opponents worried that confusion would arise when
basic dict promises (like that ``x in d`` implies that ``x in
d.keys()`` and ``d[x]`` doesn't raise a KeyError) could be
conditionally overridden by the existence of a ``default_factory``
attribute. Others worried about complicating the dict API with yet
another method, especially one that was never meant to be called
directly (only overridden in subclasses). Eventually, Guido was
convinced that instead of modifying the builtin dict type, a new
collections.defaultdict should be introduced.
Guido then defended keeping ``on_missing`` as a method of the dict
type, noting that without ``on_missing`` any subclasses (e.g.
``collections.defaultdict``) that wanted to override the behavior for
missing keys would have to override ``__getitem__`` and pay the
penalty on every call instead of just the ones where the key wasn't
present. In the patch committed to the Python trunk, ``on_missing``
was renamed to ``__missing__`` and though no ``__missing__`` method is
defined for the dict type, if a subclass defines it, it will be called
instead of raising the usual KeyError.
Contributing threads:
- `Proposal: defaultdict
<http://mail.python.org/pipermail/python-dev/2006-February/061169.html>`__
- `Counter proposal: multidict (was: Proposal: defaultdict)
<http://mail.python.org/pipermail/python-dev/2006-February/061264.html>`__
- `Counter proposal: multidict
<http://mail.python.org/pipermail/python-dev/2006-February/061276.html>`__
- `defaultdict proposal round three
<http://mail.python.org/pipermail/python-dev/2006-February/061485.html>`__
- `defaultdict and on_missing()
<http://mail.python.org/pipermail/python-dev/2006-February/061702.html>`__
- `getdefault(), the real replacement for setdefault()
<http://mail.python.org/pipermail/python-dev/2006-February/061748.html>`__
[SJB]
-----------------------------------------
Encode and decode interface in Python 3.0
-----------------------------------------
Jason Orendorff suggested that ``bytes.encode()`` and
``text.decode()`` (where text is the name of Python 3.0's str/unicode)
should be removed in Python 3.0. Guido agreed, suggesting that Python
3.0 should have one of the following APIs for encoding and decoding:
- bytes.decode(enc) -> text
text.encode(enc) -> bytes
- text(bytes, enc) -> text
bytes(text, enc) -> bytes
There was a lot of discussion about how hard it was for beginners to
figure out the current ``.encode()`` and ``.decode()`` methods, and
Martin v. Löwis suggested that the behavior::
py> "Martin v. Löwis".encode("utf-8")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0xf6 in
position 11: ordinal not in range(128)
would be better if replaced by Guido's suggested behavior::
py> "Martin v. Löwis".encode("utf-8")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: 'str' object has no attribute 'encode'
since the user would immediately know that they had made a mistake by
trying to encode a string. However, some people felt that this problem
could be solved by simply changing the UnicodeDecodeError to something
more informative like ``ValueError: utf8 can only encode unicode
objects``.
M.-A. Lemburg felt strongly that text and bytes objects should keep
both ``.encode()`` and ``.decode()`` methods as simple interfaces to
the registered codecs. Since the codecs system handles general
encodings (not just text<->bytes encodings) he felt that ``.encode()``
and ``.decode()`` should be available on both bytes and text objects
and should be able to return whatever type the encoding deems
appropriate. Guido repeated one of his design guidelines: the return
*type* of a function should not depend on the *value* of the
arguments. Thus he would prefer that ``bytes.decode()`` only return
text and ``text.decode()`` only return bytes, regardless of the
encodings passed in. (He didn't seem to be commenting on the
architecture of the codecs module however, just the architecture of
the bytes and text types.)
Contributing threads:
- `bytes.from_hex() [Was: PEP 332 revival in coordination with pep
349?] <http://mail.python.org/pipermail/python-dev/2006-February/061037.html>`__
- `bytes.from_hex() [Was: PEP 332 revival in coordination with pep
349?] <http://mail.python.org/pipermail/python-dev/2006-February/061104.html>`__
- `str.translate vs unicode.translate (was: Re: str object going in
Py3K) <http://mail.python.org/pipermail/python-dev/2006-February/061179.html>`__
- `bytes.from_hex()
<http://mail.python.org/pipermail/python-dev/2006-February/061190.html>`__
- `str.translate vs unicode.translate
<http://mail.python.org/pipermail/python-dev/2006-February/061222.html>`__
[SJB]
-----------------
Writable closures
-----------------
Almann T. Goo was considering writing a PEP to allow write access to
names in nested scopes. Currently, names in nested scopes can only be
read, not written, so the following code fails with an
UnboundLocalError::
def getinc(start=0):
def incrementer(inc=1):
start += inc
return start
return incrementer
Almann suggested introducing a new declaration, along the lines of
``global``, to indicate that assignments to a name should be
interpreted as assignments to the name in the nearest enclosing scope.
Initially, he proposed the term ``use`` for this declaration, but
most of the thread participants seemed to prefer ``outer``, allowing
the function above to be written as::
def getinc(start=0):
def incrementer(inc=1):
outer start
start += inc
return start
return incrementer
A variety of syntactic variants achieving similar results were
proposed, including a way to name a function's local namespace::
def getinc(start=0):
namespace xxx
def incrementer(inc=1):
xxx.start += inc
return xxx.start
return incrementer
a way to indicate when a single use of a name should refer to the
outer scope, based on the syntax for `relative imports`_::
def getinc(start=0):
def incrementer(inc=1):
.start += inc # note the "."
return .start # note the "." (this one could be optional)
return incrementer
and the previously suggested rebinding statement, from `PEP 227`_::
def getinc(start=0):
def incrementer(inc=1):
start +:= inc # note the ":=" instead of "="
return start
return incrementer
Much like the last time this issue was brought up, "the discussion
fizzled out after having failed to reach a consensus on an obviously
right way to go about it" (Greg Ewing's quite appropriate wording).
No PEP was produced, and it didn't seem like one would soon be
forthcoming.
.. _PEP 227: http://www.python.org/peps/pep-0227.html
.. _relative imports: http://www.python.org/peps/pep-0328.html
Contributing threads:
- `PEP for Better Control of Nested Lexical Scopes
<http://mail.python.org/pipermail/python-dev/2006-February/061568.html>`__
- `Papal encyclical on the use of closures (Re: PEP for Better Control
of Nested Lexical Scopes)
<http://mail.python.org/pipermail/python-dev/2006-February/061596.html>`__
- `Using and binding relative names (was Re: PEP for Better Control of
Nested Lexical Scopes)
<http://mail.python.org/pipermail/python-dev/2006-February/061636.html>`__
[SJB]
---------------------------
PEP 358: The "bytes" Object
---------------------------
This week mostly wrapped up the bytes type discussion from the last
fortnight, with the introduction of `PEP 358`_: The "bytes" Object.
The PEP proposes a ``bytes`` type which:
* is a sequence of range(0, 256) int objects
* can be constructed out of lists of range(0, 256) ints
* can be constructed out of the characters of str objects
* can be constructed out of unicode objects using a specified encoding
(or the system default encoding if none is specified)
* can be constructed out of a hex string using the classmethod ``bytes.fromhex``
The bytes constructor allows an encoding for unicode objects (instead
of requiring a call to unicode.encode) so as not to require double
copying (one of encoding and one for conversion to bytes). Some
people took issue with the fact that constructor allows an encoding
for str objects, but ignores it, as this means code like ``bytes(s,
'utf-16be')`` will do a different thing for str and unicode. Ignoring
the encoding argument for str objects was apparently intended to ease
the transition from str to bytes, though it was not clear exactly how.
.. _PEP 358: http://www.python.org/peps/pep-0358.html
Contributing threads:
- `bytes type needs a new champion
<http://mail.python.org/pipermail/python-dev/2006-February/061080.html>`__
- `bytes type discussion
<http://mail.python.org/pipermail/python-dev/2006-February/061082.html>`__
- `Pre-PEP: The "bytes" object
<http://mail.python.org/pipermail/python-dev/2006-February/061100.html>`__
- `s/bytes/octet/ [Was:Re: bytes.from_hex() [Was: PEP 332 revival in
coordination with pep 349?]]
<http://mail.python.org/pipermail/python-dev/2006-February/061482.html>`__
- `PEP 358 (bytes type) comments
<http://mail.python.org/pipermail/python-dev/2006-February/061728.html>`__
[SJB]
----------------------------------
Compiling Python with MS VC++ 2005
----------------------------------
M.-A. Lemburg suggested compiling Python with the new `MS VC++ 2005`_,
especially since it's "free". There was some concern about the
stability of VS2005, and Benji York pointed out that the express
editions are only `free until November 6th`_. Fredrik Lundh pointed
out that it would be substantially more work for all the developers
who provide ready-made Windows binaries for multiple Python releases.
In the end, they decided to keep with the current compiler at least
for one more release.
.. _MS VC++ 2005: http://msdn.microsoft.com/vstudio/express/default.aspx
.. _free until November 6th:
http://msdn.microsoft.com/vstudio/express/support/faq/default.aspx#pricing
Contributing thread:
- `Switch to MS VC++ 2005 ?!
<http://mail.python.org/pipermail/python-dev/2006-February/061870.html>`__
[SJB]
-----------------------
Alternate lambda syntax
-----------------------
Even though Guido already declared that Python 3.0 will keep the
current lambda syntax, Talin decided to try out the new AST and give
lambda a face-lift. With `Talin's patch`_, you can now write lambdas
like::
>>> a = (x*x given (x))
>>> a(9)
81
>>> a = (x*y given (x=3,y=4))
>>> a(9, 10)
90
>>> a(9)
36
>>> a()
12
The patch was remarkably simple, and people were suitably impressed by
the flexibility of the new AST. Of course, the patch was rejected
since Guido is now happy with the current lambda situation.
.. _Talin's patch: http://bugs.python.org/1434008
Contributing thread:
- `Adventures with ASTs - Inline Lambda
<http://mail.python.org/pipermail/python-dev/2006-February/061124.html>`__
[SJB]
---------------
Stateful codecs
---------------
Walter Dörwald was looking for ways to cleanly support stateful
codecs. M.-A. Lemburg suggested extending the codec registry to
maintain slots for the stateful encoders and decoders (and allowing
six-tuples to be passed in) and adding the functions
``codecs.getencoderobject()`` and ``codecs.getdecoderobject()``.
Walter Dörwald suggested that ``codecs.lookup()`` should return
objects with the following attributes:
(1) Name
(2) Encoder function
(3) Decoder function
(4) Stateful encoder factory
(5) Stateful decoder factory
(6) Stream writer factory
(7) Stream reader factory
For the sake of backwards compatibility, these objects would subclass
tuple so that they look like the old four-tuples returned by
``codecs.lookup()``. `Walter's patch`_ provides an implementation of
some of these suggestions.
.. _Walter's patch: http://bugs.python.org/1436130
Contributing thread:
- `Stateful codecs [Was: str object going in Py3K]
<http://mail.python.org/pipermail/python-dev/2006-February/061230.html>`__
[SJB]
---------------------------------------
operator.is*Type and user-defined types
---------------------------------------
Michael Foord pointed out that for types written in Python,
``operator.isMappingType`` and ``operator.isSquenceType`` are
essentially identical -- they both return True if ``__getitem__`` is
defined. Raymond Hettinger and Greg Ewing explained that for types
written in C, these functions can give more detailed information
because at the C level, CPython differentiates between the
``__getitem__`` of the sequence protocol and the ``__getitem__`` of
the mapping protocol.
Contributing thread:
- `operator.is*Type
<http://mail.python.org/pipermail/python-dev/2006-February/061698.html>`__
[SJB]
--------------------------
Python-level AST interface
--------------------------
Brett Cannon started a brief thread to discuss where to go next with
the Python AST branch. Though some of the discussion moved online at
PyCon, the major decisions were reported by Martin v. Löwis:
* The ast-objects branch (which used reference-counting instead of
arena allocation) was dropped because it seemed less maintainable and
people had agreed that exposing the C AST objects to Python was a bad
idea anyway
* Python code would have access to a "shadow tree" of the actual AST
tree, accessible by calling ``compile()`` with the flag PyCF_ONLY_AST
(0x400).
As a result, Python 2.5 now has a Python-level interface to AST objects::
>>> compile('"spam" if x else 42', '<string>', 'eval', 0x400)
<_ast.Expression object at 0x00BA0F50>
Contributing threads:
- `C AST to Python discussion
<http://mail.python.org/pipermail/python-dev/2006-February/060994.html>`__
- `C AST to Python discussion
<http://mail.python.org/pipermail/python-dev/2006-February/061109.html>`__
- `[Python-projects] AST in Python 2.5
<http://mail.python.org/pipermail/python-dev/2006-February/061145.html>`__
- `Exposing the abstract syntax
<http://mail.python.org/pipermail/python-dev/2006-February/061850.html>`__
- `quick status report
<http://mail.python.org/pipermail/python-dev/2006-February/061892.html>`__
[SJB]
-------------------------------------------
Allowing property to be used as a decorator
-------------------------------------------
Georg Brandl suggested in passing that it would be nice if
``property()`` could be used as a decorator. Ian Bicking pointed out
that you can already use ``property()`` this way as long as you only
want a read-only property. However, the resulting property has no
docstring, so Alex Martelli suggested that property use the __doc__ of
its fget function if no docstring was provided. Guido approved it, and
`Georg Brandl provided a patch`_. Thus in Python 2.5, you'll be able
to write read-only properties like::
@property
def x(self):
"""The x property"""
return self._x + 42
.. _Georg Brandl provided a patch: http://bugs.python.org/1434038
Contributing threads:
- `The decorator(s) module
<http://mail.python.org/pipermail/python-dev/2006-February/060759.html>`__
- `The decorator(s) module
<http://mail.python.org/pipermail/python-dev/2006-February/061227.html>`__
[SJB]
-----------------------------------------------
Turning on unicode string literals for a module
-----------------------------------------------
Neil Schemenauer asked if it would be possible to have a ``from
__future__ import unicode_strings`` statement which would turn all
string literals into unicode literals for that module (without
requiring the usual ``u`` prefix). Currently, you can turn on this
kind of behavior for all modules using the undocumented -U
command-line switch, but there's no way of enabling it on a per-module
basis. There didn't seem to be enough momentum in the thread to
implement such a thing however.
Contributing thread:
- `from __future__ import unicode_strings?
<http://mail.python.org/pipermail/python-dev/2006-February/061088.html>`__
[SJB]
-------------------------------------------
Allowing cProfile to print to other streams
-------------------------------------------
Skip Montaro pointed out that the new cProfile module prints stuff to
stdout. He suggested rewriting the necessary bits to add a stream=
keyword argument where necessary and using stream.write(...) instead
of the print statements. No patch was available at the time of this
summary.
Contributing thread:
- `cProfile prints to stdout?
<http://mail.python.org/pipermail/python-dev/2006-February/061815.html>`__
[SJB]
--------------------------------
PEP 343 with-statement semantics
--------------------------------
Mike Bland provided an initial implementation of `PEP 343`_'s
with-statment. In writing some unit-tests for it, Guido discovered
that the implementation would not allow generators like::
@contextmanager
def foo():
try:
yield
except Exception:
pass
with foo():
1/0
to be equivalent to the corresponding in-line code::
try:
1/0
except Exception:
pass
because the PEP at the time did not allow context objects to suppress
exceptions. Guido modified the patch and the PEP to require __exit__
to reraise the exception if it didn't want it suppressed.
.. _PEP 343: http://www.python.org/peps/pep-0343.html
Contributing threads:
- `PEP 343 "with" statement patch
<http://mail.python.org/pipermail/python-dev/2006-February/061637.html>`__
- `with-statement heads-up
<http://mail.python.org/pipermail/python-dev/2006-February/061903.html>`__
[SJB]
------------------------------------
Dropping Win9x support in Python 2.6
------------------------------------
Neal Norwitz suggested that Python 2.6 no longer try to support Win9x
and WinME and updated `PEP 11`_ accordingly. There was a little
rumbling about dropping the support, but no one stepped forward to
volunteer to maintain the patches, and Guido suggested that anyone
using a 6+ year old OS should be fine using an older Python too.
.. _PEP 11: http://www.python.org/dev/peps/pep-0011/
Contributing thread:
- `Dropping support for Win9x in 2.6
<http://mail.python.org/pipermail/python-dev/2006-February/061791.html>`__
[SJB]
----------------------------
Removing non-Unicode support
----------------------------
Neal Norwitz suggested that the --disable-unicode switch might be a
candidate for removal in Python 2.6. A few people were mildly
concerned that the inability to remove Unicode support might make it
harder to put Python on small hand-held devices. However, many
(though not all) hand-helds already support Unicode, and currently a
number of tests already fail if you use the --disable-unicode switch,
so those who need this switch have not been actively maintaining it.
Stripping out the numerous Py_USING_UNICODE declarations would
substantially simplify some of the Python source. No final decision
had been made at the time of this summary.
Contributing thread:
- `Removing Non-Unicode Support?
<http://mail.python.org/pipermail/python-dev/2006-February/061464.html>`__
[SJB]
------------------------------------
Translating the Python documentation
------------------------------------
Facundo Batista had proposed translating the Library Reference and
asked about how to get notifications when the documentation was
updated (so that the translations could also be updated). Georg Brandl
suggested a post-commit hook in SVN, though this would only give
notifications at the module level. Fredrik Lundh suggested something
based on his `more dynamic library reference platform`_ so that the
notifications could indicate particular methods and functions instead.
.. _more dynamic library reference platform: http://effbot.org/zone/pyref.htm
Contributing threads:
- `Translating docs
<http://mail.python.org/pipermail/python-dev/2006-February/061823.html>`__
- `Fwd: Translating docs
<http://mail.python.org/pipermail/python-dev/2006-February/061834.html>`__
[SJB]
---------------
PEP 338 updates
---------------
At Guido's suggestion, Nick Coghlan pared down `PEP 338`_ to just the
bare bones necessary to properly implement the -m switch. That means
the runpy module will contain only a single function, run_module,
which will import the named module using the standard import
mechanism, and then execute the code in that module.
.. _PEP 338: http://www.python.org/peps/pep-0338.html
Contributing thread:
- `PEP 338 issue finalisation (was Re: 2.5 PEP)
<http://mail.python.org/pipermail/python-dev/2006-February/061131.html>`__
[SJB]
-----------------
Bugfix procedures
-----------------
Just a reminder of the procedure for applying bug patches in Python
(thanks to a brief thread started by Arkadiusz Miskiewicz). Anyone can
submit a patch, but it will not be committed until a committer reviews
and commits the patch. Non-committers are encouraged to review and
comment on patches, and a number of the committers have promised that
anyone who reviews and comments on at least five patches can have any
patch they like looked at.
Contributing threads:
- `how bugfixes are handled?
<http://mail.python.org/pipermail/python-dev/2006-February/061067.html>`__
- `how bugfixes are handled?
<http://mail.python.org/pipermail/python-dev/2006-February/061120.html>`__
[SJB]
--------------------------------
Removing --with-wctype-functions
--------------------------------
M.-A. Lemburg suggested removing support for --with-wctype-functions
as it makes Unicode support work in non-standard ways. Though he
announced the plan in December 2004, ``PEP 11`` wasn't updated, so
removal will be delayed until Python 2.6.
Contributing thread:
- `[Python-checkins] r42396 - peps/trunk/pep-0011.txt
<http://mail.python.org/pipermail/python-dev/2006-February/061159.html>`__
[SJB]
---------------------------------
Making ASCII the default encoding
---------------------------------
Neal Norwitz asked if we should finally make ASCII the default
encoding as `PEP 263`_ had promised in Python 2.3. He received only
positive responses on this, and so in Python 2.5, any file missing a
``# -*- coding: ... -*-`` declaration and using non-ASCII characters
will generate an error.
.. _PEP 263: http://www.python.org/peps/pep-0263.html
Contributing thread:
- `Making ascii the default encoding
<http://mail.python.org/pipermail/python-dev/2006-February/061884.html>`__
[SJB]
-------------------------------------------
PEP 308: Conditional Expressions checked in
-------------------------------------------
Thomas Wouters checked in a patch for `PEP 308`_, so Python 2.5 now
has the long-awaited conditional expressions!
.. _PEP 308: http://www.python.org/dev/peps/pep-0308/
Contributing thread:
- `PEP 308 <http://mail.python.org/pipermail/python-dev/2006-February/061855.html>`__
[SJB]
==================
Previous Summaries
==================
- `http://www.python.org/dev/doc/devel still available
<http://mail.python.org/pipermail/python-dev/2006-February/061078.html>`__
- `str object going in Py3K
<http://mail.python.org/pipermail/python-dev/2006-February/061081.html>`__
- `PEP 332 revival in coordination with pep 349? [ Was:Re: release
plan for 2.5 ?]
<http://mail.python.org/pipermail/python-dev/2006-February/061084.html>`__
- `nice() <http://mail.python.org/pipermail/python-dev/2006-February/061086.html>`__
- `bdist_* to stdlib?
<http://mail.python.org/pipermail/python-dev/2006-February/061105.html>`__
- `Please comment on PEP 357 -- adding nb_index slot to
PyNumberMethods
<http://mail.python.org/pipermail/python-dev/2006-February/061165.html>`__
===============
Skipped Threads
===============
- `ssize_t branch merged
<http://mail.python.org/pipermail/python-dev/2006-February/061083.html>`__
- `Off-topic: www.python.org
<http://mail.python.org/pipermail/python-dev/2006-February/061090.html>`__
- `Weekly Python Patch/Bug Summary
<http://mail.python.org/pipermail/python-dev/2006-February/061106.html>`__
- `2.5 - I'm ok to do release management
<http://mail.python.org/pipermail/python-dev/2006-February/061117.html>`__
- `Rename str/unicode to text [Was: Re: str object going in Py3K]
<http://mail.python.org/pipermail/python-dev/2006-February/061134.html>`__
- `Does eval() leak?
<http://mail.python.org/pipermail/python-dev/2006-February/061149.html>`__
- `Rename str/unicode to text [Was: Re: str object goingin Py3K]
<http://mail.python.org/pipermail/python-dev/2006-February/061153.html>`__
- `Test failures in test_timeout
<http://mail.python.org/pipermail/python-dev/2006-February/061155.html>`__
- `Rename str/unicode to text
<http://mail.python.org/pipermail/python-dev/2006-February/061205.html>`__
- `Copying zlib compression objects
<http://mail.python.org/pipermail/python-dev/2006-February/061247.html>`__
- `Serial function call composition syntax foo(x, y) -> bar() ->
baz(z) <http://mail.python.org/pipermail/python-dev/2006-February/061282.html>`__
- `A codecs nit
<http://mail.python.org/pipermail/python-dev/2006-February/061365.html>`__
- `Stackless Python sprint at PyCon 2006
<http://mail.python.org/pipermail/python-dev/2006-February/061367.html>`__
- `[Python-checkins] r42490 - in python/branches/release24-maint:
Lib/fileinput.py Lib/test/test_fileinput.py Misc/NEWS
<http://mail.python.org/pipermail/python-dev/2006-February/061421.html>`__
- `Enhancements to the fileinput module
<http://mail.python.org/pipermail/python-dev/2006-February/061428.html>`__
- `test_fileinput failing on Windows
<http://mail.python.org/pipermail/python-dev/2006-February/061446.html>`__
- `New Module: CommandLoop
<http://mail.python.org/pipermail/python-dev/2006-February/061450.html>`__
- `(-1)**(1/2)==1?
<http://mail.python.org/pipermail/python-dev/2006-February/061487.html>`__
- `documenting things [Was: Re: Proposal: defaultdict]
<http://mail.python.org/pipermail/python-dev/2006-February/061499.html>`__
- `Simple CPython stack overflow.
<http://mail.python.org/pipermail/python-dev/2006-February/061506.html>`__
- `problem with genexp
<http://mail.python.org/pipermail/python-dev/2006-February/061544.html>`__
- `readline compilarion fails on OSX
<http://mail.python.org/pipermail/python-dev/2006-February/061561.html>`__
- `Memory Error the right error for coding cookie promise violation?
<http://mail.python.org/pipermail/python-dev/2006-February/061576.html>`__
- `Two patches <http://mail.python.org/pipermail/python-dev/2006-February/061642.html>`__
- `Unifying trace and profile
<http://mail.python.org/pipermail/python-dev/2006-February/061669.html>`__
- `Fixing copy.py to allow copying functions
<http://mail.python.org/pipermail/python-dev/2006-February/061673.html>`__
- `Path PEP: some comments (equality)
<http://mail.python.org/pipermail/python-dev/2006-February/061677.html>`__
- `calendar.timegm
<http://mail.python.org/pipermail/python-dev/2006-February/061678.html>`__
- `release plan for 2.5 ?
<http://mail.python.org/pipermail/python-dev/2006-February/061731.html>`__
- `[ python-Feature Requests-1436243 ] Extend pre-allocated integers
to cover [0, 255]
<http://mail.python.org/pipermail/python-dev/2006-February/061734.html>`__
- `buildbot, and test failures
<http://mail.python.org/pipermail/python-dev/2006-February/061737.html>`__
- `OT: T-Shirts
<http://mail.python.org/pipermail/python-dev/2006-February/061778.html>`__
- `PEP 328 <http://mail.python.org/pipermail/python-dev/2006-February/061813.html>`__
- `Current trunk test failures
<http://mail.python.org/pipermail/python-dev/2006-February/061861.html>`__
- `PEP 332 revival in coordination with pep 349? [Was:Re: release plan
for 2.5 ?] <http://mail.python.org/pipermail/python-dev/2006-February/061866.html>`__
- `str.count is slow
<http://mail.python.org/pipermail/python-dev/2006-February/061885.html>`__
- `Long-time shy failure in test_socket_ssl
<http://mail.python.org/pipermail/python-dev/2006-February/061893.html>`__
========
Epilogue
========
This is a summary of traffic on the `python-dev mailing list`_ from
February 16, 2006 through February 28, 2006.
It is intended to inform the wider Python community of on-going
developments on the list on a semi-monthly basis. An archive_ of
previous summaries is available online.
An `RSS feed`_ of the titles of the summaries is available.
You can also watch comp.lang.python or comp.lang.python.announce for
new summaries (or through their email gateways of python-list or
python-announce, respectively, as found at http://mail.python.org).
This python-dev summary is the 14th written by
the python-dev summary team of Steve Bethard and Tony Meyer (on-time,
schmon-time).
To contact us, please send email:
- Steve Bethard (steven.bethard at gmail.com)
- Tony Meyer (tony.meyer at gmail.com)
Do *not* post to comp.lang.python if you wish to reach us.
The `Python Software Foundation`_ is the non-profit organization that
holds the intellectual property for Python. It also tries to advance
the development and use of Python. If you find the python-dev Summary
helpful please consider making a donation. You can make a donation at
http://python.org/psf/donations.html . Every cent counts so even a
small donation with a credit card, check, or by PayPal helps.
--------------------
Commenting on Topics
--------------------
To comment on anything mentioned here, just post to
`comp.lang.python`_ (or email python-list(a)python.org which is a
gateway to the newsgroup) with a subject line mentioning what you are
discussing. All python-dev members are interested in seeing ideas
discussed by the community, so don't hesitate to take a stance on
something. And if all of this really interests you then get involved
and join `python-dev`_!
-------------------------
How to Read the Summaries
-------------------------
That this summary is written using reStructuredText_. Any unfamiliar
punctuation is probably markup for reST_ (otherwise it is probably
regular expression syntax or a typo :); you can safely ignore it. We
do suggest learning reST, though; it's simple and is accepted for
`PEP markup`_ and can be turned into many different formats like HTML
and LaTeX. Unfortunately, even though reST is standardized, the
wonders of programs that like to reformat text do not allow us to
guarantee you will be able to run the text version of this summary
through Docutils_ as-is unless it is from the `original text file`_.
.. _python-dev: http://www.python.org/dev/
.. _SourceForge: http://sourceforge.net/tracker/?group_id=5470
.. _python-dev mailing list: http://mail.python.org/mailman/listinfo/python-dev
.. _c.l.py:
.. _comp.lang.python: http://groups.google.com/groups?q=comp.lang.python
.. _PEP Markup: http://www.python.org/peps/pep-0012.html
.. _Docutils: http://docutils.sf.net/
.. _reST:
.. _reStructuredText: http://docutils.sf.net/rst.html
.. _PSF:
.. _Python Software Foundation: http://python.org/psf/
.. _original text file:
http://www.python.org/dev/summary/2006-02-16_2006-02-28.rst
.. _archive: http://www.python.org/dev/summary/
.. _RSS feed: http://www.python.org/dev/summary/channews.rdf
1
0

April 29, 2006
python-dev Summary for 2006-02-01 through 2006-02-15
++++++++++++++++++++++++++++++++++++++++++++++++++++
.. contents::
[The HTML version of this Summary is available at
http://www.python.org/dev/summary/2006-02-01_2006-02-15]
=============
Announcements
=============
-----------------------------
QOTF: Quotes of the Fortnight
-----------------------------
We had a plethora (yes, I did just say plethora) of quotable quotes
this fortnight.
Martin v. Löwis on the `lambda keyword`_:
I believe that usage of a keyword with the name of a Greek letter
also contributes to people considering something broken.
Raymond Hettinger on the `learnability of Python`_:
A language suitable for beginners should be easy to learn, but it
should not leave them permanently crippled... To misquote Einstein:
The language should be as simple as possible, but no simpler.
Robert Brewer on `Pythonic syntax`_:
Community consensus on syntax is a pipe dream.
.. _lambda keyword:
http://mail.python.org/pipermail/python-dev/2006-February/060389.html
.. _learnability of Python:
http://mail.python.org/pipermail/python-dev/2006-February/060420.html
.. _Pythonic syntax:
http://mail.python.org/pipermail/python-dev/2006-February/060556.html
[SJB]
--------------------
Release plan for 2.5
--------------------
`PEP 356`_ lists the release plan for Python 2.5. Check it out for
the latest feature updates and planned release dates.
.. _PEP 356: http://www.python.org/dev/peps/pep-0356/
Contributing threads:
- `release plan for 2.5 ?
<http://mail.python.org/pipermail/python-dev/2006-February/060493.html>`__
- `2.5 release schedule
<http://mail.python.org/pipermail/python-dev/2006-February/060982.html>`__
- `2.5 PEP <http://mail.python.org/pipermail/python-dev/2006-February/060985.html>`__
[SJB]
----------------------------
lsprof available as cProfile
----------------------------
Armin Rigo finished his integration of the lsprof profiler. It's now
available as the cProfile module which exposes the same interface as
profile.
Contributing thread:
- `cProfile module
<http://mail.python.org/pipermail/python-dev/2006-February/060479.html>`__
[SJB]
---------------------
ssize_t branch merged
---------------------
Martin v. Löwis merged in the ssize_t branch (`PEP 353`_). All you
folks on 64 bit machines should now be able to index sequences using
your full address space. Enjoy!
.. _PEP 353: http://www.python.org/dev/peps/pep-0353/
Contributing threads:
- `ssize_t status (Was: release plan for 2.5 ?)
<http://mail.python.org/pipermail/python-dev/2006-February/060714.html>`__
- `ssize_t branch (Was: release plan for 2.5 ?)
<http://mail.python.org/pipermail/python-dev/2006-February/060810.html>`__
- `ssize_t branch merged
<http://mail.python.org/pipermail/python-dev/2006-February/061073.html>`__
[SJB]
=========
Summaries
=========
------------------------------------------------------
Rumors of lambda's death have been greatly exaggerated
------------------------------------------------------
Guido's finally given in -- the lambda expression will stay in Python
3.0. Of course, this didn't stave off another massively long thread
discussing the issue, but Guido finally killed that by providing a
pretty exhaustive list of why we should keep lambda as it is:
* No purely `syntactic change to lambda`_ is clearly a net gain over
the current syntax
* It's perfectly fine that Python's lambda is different from Lisp's
* Lambda current binding behavior is (correctly) exactly the same as a
def statement
* Allowing a block inside a lambda is never going to work because of
the need to indent the block
.. _syntactic change to lambda:
http://wiki.python.org/moin/AlternateLambdaSyntax
Contributing threads:
- `any support for a methodcaller HOF?
<http://mail.python.org/pipermail/python-dev/2006-February/060341.html>`__
- `Let's just *keep* lambda
<http://mail.python.org/pipermail/python-dev/2006-February/060415.html>`__
- `Let's send lambda to the shearing shed (Re: Let's just *keep*
lambda) <http://mail.python.org/pipermail/python-dev/2006-February/060583.html>`__
[SJB]
--------------
The bytes type
--------------
Guido asked for an update to `PEP 332`_, which proposed a ``bytes``
type. This spawned a massive discussion about what the bytes type
should look like and how it should interact with strings, especially
in Python 3.0 when all strings would be unicode. Pretty much everyone
agreed that bytes objects should be mutable sequences of ints in the
range(0, 256). Guido and others were also generally against a b'...'
literal for bytes, as that would confusingly suggest that bytes
objects were text-like, which they wouldn't be.
There was a fair bit of haggling over the signature of the bytes
constructor, but it seemed towards the end of the discussion that
people were coming to an agreement on ``bytes(initializer
[,encoding])``, where ``initializer`` could be a sequence of ints or a
str or unicode instance, and where ``encoding`` would be an error for
a sequence of ints, ignored for a str instance, and the encoding for a
unicode instance. Some people argued that the encoding argument was
unnecessary as unicode objects could be encoded using their .encode()
method, but Guido was concerned that, at least before Python 3.0 when
.encode() would return bytes objects, the multiple copying (one for
the encode, one for the bytes object creation) would require too much
overhead.
The default encoding for unicode objects was also a contentious point,
with people suggesting ASCII, Latin-1, and the system default
encoding. Guido argued that since Python strings don't know the
encoding that was used to create them, and since a programmer who
typed in Latin-1 would expect Latin-1 as the encoding and a programmer
who typed in UTF-8 would expect UTF-8 as the encoding, then the only
sensible solution was to encode unicode objects using the system
default encoding (which is pretty much always ASCII).
It seemed like an official PEP for the bytes type would be forthcoming.
.. _PEP 332: http://www.python.org/peps/pep-0332.html
Contributing threads:
- `PEP 332 revival in coordination with pep 349? [ Was:Re: release
plan for 2.5 ?]
<http://mail.python.org/pipermail/python-dev/2006-February/060752.html>`__
- `bytes type discussion
<http://mail.python.org/pipermail/python-dev/2006-February/060930.html>`__
- `byte literals unnecessary [Was: PEP 332 revival in coordination
with pep 349?] <http://mail.python.org/pipermail/python-dev/2006-February/060944.html>`__
- `bytes type needs a new champion
<http://mail.python.org/pipermail/python-dev/2006-February/061058.html>`__
[SJB]
--------------
Octal literals
--------------
Mattheww proposed removing octal literals, making 0640 a SyntaxError,
and modifying functions like os.chmod to take string arguments
instead, e.g. ``os.chmod(path, "0640")``. This led to a discussion
about how necessary octal literals actually are -- the only use case
mentioned in the thread was os.chmod() -- and how to improve their
syntax. For octal literals people seemed to prefer an ``0o`` or
``0c`` prefix along the lines of the ``0x`` prefix, possibly
introducing an analogous ``0b`` as binary literal syntax at the same
time. People also suggested a number of syntaxes for expressing
numeric literals in any base, but these seemed like overkill for the
problem at hand.
Contributing threads:
- `Octal literals
<http://mail.python.org/pipermail/python-dev/2006-January/060262.html>`__
- `Octal literals
<http://mail.python.org/pipermail/python-dev/2006-February/060277.html>`__
[SJB]
---------------------------------------------------
PEP 357: Allowing Any Object to be Used for Slicing
---------------------------------------------------
Travis Oliphant presented `PEP 357`_ to address some issues with the
sequence protocol. In Python 2.4 and earlier, if you defined an
integer-like type, there was no way of letting Python use instances of
your type in sequence indexing. And Python couldn't just call the
``__int__`` slot because then floats could be inappropriately used as
indices, e.g. ``range(10)[5.7]`` would be ``5``. To solve this
problem, `PEP 357`_ proposed adding an ``__index__`` slot that would
be called when a sequence was given a non-integer in a slice. Floats
would not define ``__index__`` because they could not be guaranteed to
produce an exact integer, but exact integers like those in numpy_
could define this method and then be allowable as sequence indices.
.. _PEP 357: http://www.python.org/peps/pep-0357.html
.. _numpy: http://www.numpy.org/
Contributing threads:
- `PEP for adding an sq_index slot so that any object, a or b, can be
used in X[a:b] notation
<http://mail.python.org/pipermail/python-dev/2006-February/060594.html>`__
- `Please comment on PEP 357 -- adding nb_index slot to
PyNumberMethods
<http://mail.python.org/pipermail/python-dev/2006-February/060973.html>`__
[SJB]
-----------------------------
const declarations in CPython
-----------------------------
To avoid some deprecation warnings generated by C++, Jeremy Hylton had
added ``const`` to a few CPython APIs that took ``char*`` but were
typically called by passing string literals. This generated compiler
errors when ``char**`` variables were passed to
PyArg_ParseTupleAndKeywords. Initially, people thought this could be
solved by changing ``const char **`` declarations to ``const char *
const *`` declarations, but while this was fine for C++, it did not
solve the problem for C. The end result was to remove the ``const``
declaration from the ``char **`` variables, but not the ``char *``
variables.
Contributing thread:
- `Baffled by PyArg_ParseTupleAndKeywords modification
<http://mail.python.org/pipermail/python-dev/2006-February/060689.html>`__
[SJB]
--------------------
asynchat and threads
--------------------
Mark Edgington presented a patch adding "thread safety" to asynchat.
Most people seemed to think mixing threads and asynchat was a bad
idea, and the thread drifted off to talking about exracting a subset
of Twisted to add to the stdlib (as a replacement for asynchat and
asyncore). People seemed generally in favor of this (if the subset
was reasonably small) but no one stepped forward to extract that
subset.
Contributing thread:
- `threadsafe patch for asynchat
<http://mail.python.org/pipermail/python-dev/2006-February/060469.html>`__
[SJB]
---------------------------------------------------
Approximate equality between floating point numbers
---------------------------------------------------
To make floating-point math easier for newbies, Alex Martelli proposed
math.areclose() which would take two floating point numbers with
optional tolerances and indicate whether or not they were "equal".
With a similar motivation, Smith proposed a math.nice() function which
would round floating point numbers in the same way that str() does.
Raymond Hettinger and others expressed concern over the stated use
case and suggested that hiding floating point details would only make
learning their intricacies later more difficult. A few people
suggested that math.areclose() might also be useful for experienced
floating-point users, but it seemed that the proposal probably didn't
have enough strength to get into the stdlib.
Contributing threads:
- `math.areclose ...?
<http://mail.python.org/pipermail/python-dev/2006-February/060413.html>`__
- `nice() <http://mail.python.org/pipermail/python-dev/2006-February/060811.html>`__
- `[Tutor] nice()
<http://mail.python.org/pipermail/python-dev/2006-February/060814.html>`__
[SJB]
-----------------------------
Eliminating compiler warnings
-----------------------------
Thomas Wouters noticed a few gcc 4.0.x warnings on amd64, and asked if
Python developers should strive to remove all warnings even if they're
harmless. Tim Peters was definitely in favor of eliminating all
warnings whenever possible, and so had Thomas Wouters unnecessarily
(for other compilers at least) initialize a variable to silence the
warning.
Contributing threads:
- `Compiler warnings
<http://mail.python.org/pipermail/python-dev/2006-January/060253.html>`__
- `Compiler warnings
<http://mail.python.org/pipermail/python-dev/2006-February/060280.html>`__
[SJB]
---------------------------------
Adding syntactic support for sets
---------------------------------
Greg Wilson asked about providing syntactic support for sets literals
and set comprehensions, e.g. ``{1, 2, 3, 4, 5}`` and ``{z for z in x
if (z % 2)}``. The set comprehension suggestion was pretty quickly
shot down as it wasn't deemed to be much of an improvement over a
generator expression in the set constructor, e.g. ``set(z for z in x
if (z % 2))``. The question of syntactic support for set literals
sparked a little more of a discussion. Some people initially
suggested that syntactic support for set literals was unnecessary as
the set constructor could be expanded, e.g ``set(1, 2, 3, 4, 5)``.
However this proposal would not be backwards compatible as it would be
unclear whether ``set('title')`` should be a set of one element or
five. Others questioned whether the syntactically supported set
literal should create a set() or a frozenset(). No one had a good
answer for this latter question, and the rest of the thread drifted
off into a miscellany of syntax suggestions.
Contributing thread:
- `syntactic support for sets
<http://mail.python.org/pipermail/python-dev/2006-February/060307.html>`__
[SJB]
-------------------------------
FD_SETSIZE in Windows and POSIX
-------------------------------
Revision 42253 introduced a bug in Windows sockets by assuming that
FD_SETSIZE was the maximum number of distinct file descriptors a file
descriptor set can hold, and checking for this. FD_SETSIZE is actually
the numerical magnitude of a file descriptor (which happens to
correspond to the maximum number of distinct file descriptors on POSIX
systems where fdsets are just big bit vectors). A #define,
Py_DONT_CHECK_FD_SETSIZE, was introduced so that the check could be
skipped on windows machines.
Contributing thread:
- `Pervasive socket failures on Windows
<http://mail.python.org/pipermail/python-dev/2006-February/060666.html>`__
[SJB]
-----------------------------
Iterators and __length_hint__
-----------------------------
In Python 2.4, a number of iterators had grown __len__ methods to
allow for some optimizations (like allocating enough space to create a
list out of them). Guido had asked for these methods to be removed and
hidden instead as an implementation detail. Originally, Raymond had
used the name ``_length_cue``, but he was convinced instead to use the
name ``__length_hint__``.
Contributing thread:
- `_length_cue()
<http://mail.python.org/pipermail/python-dev/2006-February/060524.html>`__
[SJB]
-----------------------------------------------
Linking with mscvrt instead of the compiler CRT
-----------------------------------------------
Martin v. Löwis suggested that on Windows, instead of linking Python
with the CRT of the compiler used to compile Python, Python should be
linked with mscvrt, the CRT that is part of the operating system.
Martin hoped that this would get rid of problems where extension
modules had to be compiled with the same compiler as the Python with
which they were to run. Unfortunately, after further investigation,
Martin had to withdraw the proposal as the platform SDK doesn't
provide an import library for msvrt.dll and mscvrt is documented as
being intended only for "system components".
Contributing thread:
- `Linking with mscvrt
<http://mail.python.org/pipermail/python-dev/2006-February/060490.html>`__
[SJB]
-------------------------------------------
Opening text and binary files in Python 3.0
-------------------------------------------
Guido indicated that in Python 3.0 there should be two open()
functions, one for opening text files and one for opening binary
files. The .read*() methods of text files would return unicode
objects, while the .read*() methods of binary files would return bytes
objects. People then suggested a variety of names for these functions
including:
* opentext() and openbytes()
* text.open() and bytes.open()
* file.text() and file.bytes()
Guido didn't like the tight coupling of data types and IO libraries
present in the latter two. He also expressed a preference for using
open() instead of opentext(), since it was the more common use case.
Of course, modifying open() in this way would be backwards
incompatible and would thus have to wait until Python 3.0.
Contributing thread:
- `str object going in Py3K
<http://mail.python.org/pipermail/python-dev/2006-February/060896.html>`__
[SJB]
--------------------------------------------
Adding additional bdist_* installation types
--------------------------------------------
Phillip Eby suggested adding bdist_deb, bdist_msi, and friends to the
standard library in Python 2.5. People seemed generally in favor of
this, though there was some discussion as to whether or not bdist_egg
should also be included. The thread then trailed off into a
discussion of the various installation behaviors on different
platforms.
Contributing thread:
- `bdist_* to stdlib?
<http://mail.python.org/pipermail/python-dev/2006-February/060869.html>`__
[SJB]
-------------------------------------
URL for the development documentation
-------------------------------------
Georg Brandl pointed out that while http://docs.python.org/dev/ holds
the current development documentation,
http://www.python.org/dev/doc/devel was still available. Fred Drake
indicated that it was definitely preferable to use the automatically
updated docs (http://docs.python.org/dev/) but that having them on
docs.python.org seemed wrong -- docs.python.org was established so
that queries could be made for the current stable documentation
without old docs or development docs showing up. Fred then proposed
that the current stable documentation go up at
http://www.python.org/doc/current/ and the current development
documentation go up at http://www.python.org/dev/doc/. Guido thought
that http://docs.python.org/ could possibly disappear in the new
`python.org redesign`_.
.. _python.org redesign: http://beta.python.org
Contributing threads:
- `http://www.python.org/dev/doc/devel still available
<http://mail.python.org/pipermail/python-dev/2006-February/060825.html>`__
- `moving content around (Re: http://www.python.org/dev/doc/devel
still available)
<http://mail.python.org/pipermail/python-dev/2006-February/060839.html>`__
[SJB]
------------------------------------------------
PEP 355: Path - Object oriented filesystem paths
------------------------------------------------
BJörn Lindqvist updated `PEP 355`_ which proposes adding the path
module to replace some of the functions in os, shutil, etc. At Guido's
request, the use of ``/`` and ``//`` operators for path concatenation
was removed, and a number of redundancies brought up in the last Path
PEP discussion were addressed (though some redundancies, e.g.
``.name`` and ``.basename()`` seem to still be present).
.. _PEP 355: http://www.python.org/peps/pep-0355.html
Contributing threads:
- `The path module PEP
<http://mail.python.org/pipermail/python-dev/2006-February/060304.html>`__
- `Path PEP and the division operator
<http://mail.python.org/pipermail/python-dev/2006-February/060385.html>`__
- `Path PEP: some comments
<http://mail.python.org/pipermail/python-dev/2006-February/060397.html>`__
- `Path PEP -- a couple of typos.
<http://mail.python.org/pipermail/python-dev/2006-February/060399.html>`__
[SJB]
-----------------------------------------
Rejection of PEP 351: The freeze protocol
-----------------------------------------
Raymond Hettinger's strong opposition to `PEP 351`_, the freeze
protocol, finally won out, and Guido rejected the PEP.
.. _PEP 351: http://www.python.org/peps/pep-0351.html
Contributing thread:
- `PEP 351 <http://mail.python.org/pipermail/python-dev/2006-February/060789.html>`__
[SJB]
--------------------------------------
PEP 338 - Executing Modules as Scripts
--------------------------------------
Nick Coghlan updated `PEP 338`_ to comply with the import system of
`PEP 302`_. The updated PEP includes a ``run_module()`` function which
will execute the supplied module as if it were a script (e.g. with
__name__ == "__main__"). Since it supports the `PEP 302`_ import
system, it properly handles modules in both packages and zip files.
.. _PEP 302: http://www.python.org/peps/pep-0302.html
.. _PEP 338: http://www.python.org/peps/pep-0338.html
Contributing thread:
- `PEP 338 - Executing Modules as Scripts
<http://mail.python.org/pipermail/python-dev/2006-February/060760.html>`__
[SJB]
-----------------------------------------------
Getting sources for a particular Python release
-----------------------------------------------
David Abrahams wanted to get the Python-2.4.2 sources from SVN but
couldn't figure out which tag to check out. The right answer for him
was http://svn.python.org/projects/python/tags/r242/ and in general it
seemed that the r<major><minor><micro> tags corresponded to the
<major>.<minor>.<micro> release.
Contributing thread:
- `How to get the Python-2.4.2 sources from SVN?
<http://mail.python.org/pipermail/python-dev/2006-February/060770.html>`__
[SJB]
---------------------------------------
PEP for \*args and \*\*kwargs unpacking
---------------------------------------
Thomas Wouters asked if people would be interested in a PEP to
generalize the use of \*args and \*\*kwargs to unpacking, e.g.:
* ``['a', 'b', *iterable, 'c']``
* ``a, b, *rest = range(5)``
* ``{**defaults, **args, 'fixedopt': 1}``
* ``spam(*args, 3, **kwargs, spam='extra', eggs='yes')``
People definitely wanted to see a PEP, as these or similar suggestions
have been raised a number of times. The time-table would likely be
for Python 2.6 though, so no PEP has yet been made available.
Contributing thread:
- `Generalizing *args and **kwargs
<http://mail.python.org/pipermail/python-dev/2006-February/061011.html>`__
[SJB]
----------------------
Tail call optimization
----------------------
In CPython, a function call requires a new execution frame, which is
expensive compared to a loop. Some langauges (notably scheme)
automically optimize tail-call recursion, so that in practice, it will
be just as fast. This can be done in CPython by using abusing
internals.
It merged into the decorator module discussion; in the end, Guido did
not want it in the standard library, in part because it would change
exception tracebacks, and in part because it would likely be very
different for other implementations (such as Jython).
Contributing thread:
- `Any interest in tail call optimization as a decorator?
<http://mail.python.org/pipermail/python-dev/2006-February/060478.html>`__
[Summary by Jim Jewett]
--------------------------------
Things to check before a release
--------------------------------
:
Hey, we should have changed the copyright dates to include 2006!
Yeah, and lets write ourselves a note, so that we remember next year!
Uh, where should put that reminder?
PEP 101 was used, since a new release should be at least one trigger
for verifying that things like this happened. And putting it there
reminded Georg that PEP 101 needs other updates too. (Example: It
still refers to the source code in sourceforge CVS, rather than
python.org SVN)
Contributing thread:
- `Where to put "post-it notes"?
<http://mail.python.org/pipermail/python-dev/2006-February/060777.html>`__
================
Deferred Threads
================
- `The decorator(s) module
<http://mail.python.org/pipermail/python-dev/2006-February/060759.html>`__
- `C AST to Python discussion
<http://mail.python.org/pipermail/python-dev/2006-February/060994.html>`__
- `bytes.from_hex() [Was: PEP 332 revival in coordination with pep
349?] <http://mail.python.org/pipermail/python-dev/2006-February/061037.html>`__
- `how bugfixes are handled?
<http://mail.python.org/pipermail/python-dev/2006-February/061067.html>`__
==================
Previous Summaries
==================
- `Extension to ConfigParser
<http://mail.python.org/pipermail/python-dev/2006-February/060278.html>`__
- `[PATCH] Fix dictionary subclass semantics whenused as global
dictionaries <http://mail.python.org/pipermail/python-dev/2006-February/060438.html>`__
===============
Skipped Threads
===============
- `YAML (was Re: Extension to ConfigParser)
<http://mail.python.org/pipermail/python-dev/2006-February/060275.html>`__
- `webmaster at python.org failing sender verification.
<http://mail.python.org/pipermail/python-dev/2006-February/060300.html>`__
- `ctypes patch (was: (libffi) Re: Copyright issue)
<http://mail.python.org/pipermail/python-dev/2006-February/060327.html>`__
- `ctypes patch
<http://mail.python.org/pipermail/python-dev/2006-February/060332.html>`__
- `Weekly Python Patch/Bug Summary
<http://mail.python.org/pipermail/python-dev/2006-February/060468.html>`__
- `Help with Unicode arrays in NumPy
<http://mail.python.org/pipermail/python-dev/2006-February/060482.html>`__
- `small floating point number problem
<http://mail.python.org/pipermail/python-dev/2006-February/060507.html>`__
- `Old Style Classes Goiung in Py3K
<http://mail.python.org/pipermail/python-dev/2006-February/060516.html>`__
- `Make error on solaris 9 x86 - error: parse error before
"upad128_t"
<http://mail.python.org/pipermail/python-dev/2006-February/060517.html>`__
- `Python modules should link to libpython
<http://mail.python.org/pipermail/python-dev/2006-February/060533.html>`__
- `Help on choosing a PEP to volunteer on it : 308, 328 or 343
<http://mail.python.org/pipermail/python-dev/2006-February/060564.html>`__
- `email 3.1 for Python 2.5 using PEP 8 module names
<http://mail.python.org/pipermail/python-dev/2006-February/060579.html>`__
- `[BULK] Python-Dev Digest, Vol 31, Issue 37
<http://mail.python.org/pipermail/python-dev/2006-February/060585.html>`__
- `py3k and not equal; re names
<http://mail.python.org/pipermail/python-dev/2006-February/060595.html>`__
- `Post-PyCon PyPy Sprint: February 27th - March 2nd 2006
<http://mail.python.org/pipermail/python-dev/2006-February/060688.html>`__
- `compiler.pyassem
<http://mail.python.org/pipermail/python-dev/2006-February/060717.html>`__
- `To know how to set "pythonpath"
<http://mail.python.org/pipermail/python-dev/2006-February/060773.html>`__
- `file.next() vs. file.readline()
<http://mail.python.org/pipermail/python-dev/2006-February/060781.html>`__
- `Fwd: Ruby/Python Continuations: Turning a block callback into a
read()-method ?
<http://mail.python.org/pipermail/python-dev/2006-February/060813.html>`__
- `PEP 343: Context managers a superset of decorators?
<http://mail.python.org/pipermail/python-dev/2006-February/060816.html>`__
- `Missing PyCon 2006
<http://mail.python.org/pipermail/python-dev/2006-February/060873.html>`__
- `how to upload new MacPython web page?
<http://mail.python.org/pipermail/python-dev/2006-February/060983.html>`__
- `A codecs nit (was Re: bytes.from_hex())
<http://mail.python.org/pipermail/python-dev/2006-February/061070.html>`__
========
Epilogue
========
This is a summary of traffic on the `python-dev mailing list`_ from
February 01, 2006 through February 15, 2006.
It is intended to inform the wider Python community of on-going
developments on the list on a semi-monthly basis. An archive_ of
previous summaries is available online.
An `RSS feed`_ of the titles of the summaries is available.
You can also watch comp.lang.python or comp.lang.python.announce for
new summaries (or through their email gateways of python-list or
python-announce, respectively, as found at http://mail.python.org).
This python-dev summary is the 13th written by
the swat team of Steve Bethard and Tony Meyer (no, we still can't make
a deadline).
To contact us, please send email:
- Steve Bethard (steven.bethard at gmail.com)
- Tony Meyer (tony.meyer at gmail.com)
Do *not* post to comp.lang.python if you wish to reach us.
The `Python Software Foundation`_ is the non-profit organization that
holds the intellectual property for Python. It also tries to advance
the development and use of Python. If you find the python-dev Summary
helpful please consider making a donation. You can make a donation at
http://python.org/psf/donations.html . Every cent counts so even a
small donation with a credit card, check, or by PayPal helps.
--------------------
Commenting on Topics
--------------------
To comment on anything mentioned here, just post to
`comp.lang.python`_ (or email python-list(a)python.org which is a
gateway to the newsgroup) with a subject line mentioning what you are
discussing. All python-dev members are interested in seeing ideas
discussed by the community, so don't hesitate to take a stance on
something. And if all of this really interests you then get involved
and join `python-dev`_!
-------------------------
How to Read the Summaries
-------------------------
That this summary is written using reStructuredText_. Any unfamiliar
punctuation is probably markup for reST_ (otherwise it is probably
regular expression syntax or a typo :); you can safely ignore it. We
do suggest learning reST, though; it's simple and is accepted for
`PEP markup`_ and can be turned into many different formats like HTML
and LaTeX. Unfortunately, even though reST is standardized, the
wonders of programs that like to reformat text do not allow us to
guarantee you will be able to run the text version of this summary
through Docutils_ as-is unless it is from the `original text file`_.
.. _python-dev: http://www.python.org/dev/
.. _SourceForge: http://sourceforge.net/tracker/?group_id=5470
.. _python-dev mailing list: http://mail.python.org/mailman/listinfo/python-dev
.. _c.l.py:
.. _comp.lang.python: http://groups.google.com/groups?q=comp.lang.python
.. _PEP Markup: http://www.python.org/peps/pep-0012.html
.. _Docutils: http://docutils.sf.net/
.. _reST:
.. _reStructuredText: http://docutils.sf.net/rst.html
.. _PSF:
.. _Python Software Foundation: http://python.org/psf/
.. _original text file:
http://www.python.org/dev/summary/2006-02-01_2006-02-15.rst
.. _archive: http://www.python.org/dev/summary/
.. _RSS feed: http://www.python.org/dev/summary/channews.rdf
1
0

April 29, 2006
Sorry the summaries are so late. We were late already, and it's taken
me a bit of time to get set up with the new python.org site. But I
should be all good now, and hopefully we'll get caught up with all the
summaries by the end of May. Hope you all weren't too depressed
without your bi-weekly python-dev updates! ;-)
python-dev Summary for 2006-01-16 through 2006-01-31
++++++++++++++++++++++++++++++++++++++++++++++++++++
.. contents::
[The HTML version of this Summary is available at
http://www.python.org/dev/summary/2006-01-16_2006-01-31]
=============
Announcements
=============
-------------------------
Google summer internships
-------------------------
Google is looking to fill an unprecedented number of `student intern
positions`_ this (US) summer, at several US locations (Mountain View,
Santa Monica, Kirkland (Wash.), and New York). The perks are
incredible, and Google is not just looking for software development
interns - there are also product management positions, and UI design
and usability analyst positions.
Contributing thread:
- `Know anyone interested in a Google internship?
<http://mail.python.org/pipermail/python-dev/2006-January/060047.html>`__
.. _student intern positions: http://www.google.com/jobs/intern.html
[TAM]
-----------------------
Possible Summer of PyPy
-----------------------
Armin Rigo announced the possibility of a "Summer of PyPy", which
would follow the style of Google's "Summer of Code" in funding
students to work on various aspects of PyPy. The possibility has not
been confirmed yet, but we'll let you know when there's more info.
Contributing thread:
- `Summer of PyPy
<http://mail.python.org/pipermail/python-dev/2006-January/059820.html>`__
[SJB]
=========
Summaries
=========
---------------------------------------
Integers and strings in different bases
---------------------------------------
Alex Martelli requested the inverse of ``int(<string>, <base>)`` that
would convert an int into a string with digits in the appropriate
base. There was a lot of discussion of exactly where such
functionality should go. Among the suggested locations were:
* The str constructor, e.g. ``str(<number>, <base>)``
* A str classmethod, e.g. ``str.from_int(<number>, <base>)``
* An encoding method, e.g. ``str(<number>).encode("base<base>")``
* A method on ints, e.g. ``<number>.to_base(<base>)``
* A format code, e.g. ``"%<base>b" % <number>``
* A builtin function, e.g. ``base(<number>, <base>)``
* A function in the math module, e.g. ``math.base(<number>, <base>)``
People seemed generally to like the builtin function or math module
function options, though there was some debate as to the best name for
the function. Guido suggested letting the proposal sit for a week or
two to see if anyone could come up with a better name or suggest a
better location for the function. (However, he seemed generally in
favor of the proposal, suggesting that hex() and oct() should be
deprecated and removed in a future version of Python.) No decisions
had been made at the time this summary was written.
Contributing threads:
- `str with base
<http://mail.python.org/pipermail/python-dev/2006-January/059789.html>`__
[SJB]
------------------------------------------------
PEP 355: Path - Object oriented filesystem paths
------------------------------------------------
Björn Lindqvist resuscitated the idea of incorporating a Path class
based on Jason Ordenorff's path module to the standard library by
creating `PEP 355`_. There was some general discussion (and
corresponding PEP changes), with much discussion centred on the use of
"/" as a join-with-separator operator, which was eventually dropped
from the PEP.
More discussion considered whether Path should subclass string or not.
Subclassing string provides the advantage that Paths can be used in
the majority of places where strings are currently used, without
modification. However, there are many methods of strings that do not
seem appropriate for Path objects. Jason Orendorff would prefer for
Paths to not subclass strings, and a new format specifier (e.g. for
PyArg_ParseTuple()) be created for use with Paths.
There was general agreement that the utility of the module would be
highest when Path objects could be seamlessly used where string paths
were previous used. The debate centred on whether subclassing string
was the best way to do this or not. Path objects clearly are not
string objects (e.g. __iter__ and join() are nonsensical with paths).
Changing the C API so that Paths are accepted where necessary was the
suggested solution, although the PEP (at the time of writing the
summary) still subclasses Path from string.
Changing the methods from the names used by the os module and Jason's
module to ones that conform to PEP 8 was recommended. Jason explained
that the reason that there is so much cruft in his path module is that
the design is heavily skewed toward people already familiar with the
existing standard library equivalents. He feels that a standard
library Path class should have different design goals: less
redundancy, fewer methods, and PEP 8 compliant names.
.. _PEP 355: http://www.python.org/peps/pep-0355.html
Contributing threads:
- `The path module PEP
<http://mail.python.org/pipermail/python-dev/2006-January/060026.html>`__
- `/ as path join operator (was: Re: The path module PEP)
<http://mail.python.org/pipermail/python-dev/2006-January/060068.html>`__
- `/ as path join operator
<http://mail.python.org/pipermail/python-dev/2006-January/060081.html>`__
- `Path inherits from string
<http://mail.python.org/pipermail/python-dev/2006-January/060115.html>`__
- `The path module (class) PEP
<http://mail.python.org/pipermail/python-dev/2006-January/060139.html>`__
[TAM]
------------------------------
Including ctypes in the stdlib
------------------------------
The inclusion of ctypes in the standard library hit a snag: although
Guido pronounced that including it (with a strongly worded wording in
the documentation) was fine, ctypes includes libffi, which is built
with GPL'd tools, which is causes licensing issues. A lot of the
typical legal-advice-from-everyone-but-lawyers discussion took place,
but essentially what is required is a way to calculate the information
necessary to build libffi without the GPL'd tools. Hye-Shik Chang did
some work on this, and is working on integrating this into the ctypes
repository, so ctypes may still may it into the standard library.
Contributing threads:
- `Include ctypes into core Python?
<http://mail.python.org/pipermail/python-dev/2006-January/059766.html>`__
- `DRAFT: python-dev Summary for 2006-01-01 through 2006-01-15
<http://mail.python.org/pipermail/python-dev/2006-January/060099.html>`__
- `(libffi) Re: Copyright issue
<http://mail.python.org/pipermail/python-dev/2006-January/060154.html>`__
[TAM]
-----------------------------------
Improving the documentation process
-----------------------------------
Georg Brandl pointed out the new `documentation effort`_ by Fredrik
Lundh which uses a mix of HTML and PythonDoc-style markup and allows
convenient single-method links like
http://effbot.org/lib/os.path.join. Georg Brandl played around a bit
with the `CSS styling`_, however the main focus of Fredrik's effort
was to lower the threshold for user contributions. Along these lines,
he was working on an alternate content management system for editing
the Python documentation. He currently has a prototype_ available that
mirrors some of the content on python.org, though whether or not this
backend will be incorporated into python.org is as yet undecided.
.. _documentation effort: http://www.effbot.org/lib/
.. _CSS styling: http://home.in.tum.de/~brandlg/zipfile.html
.. _prototype: http://pydotorg.dyndns.org:8000/
Contributing threads:
- `New Pythondoc by effbot
<http://mail.python.org/pipermail/python-dev/2006-January/059978.html>`__
- `[Doc-SIG] that library reference, again
<http://mail.python.org/pipermail/python-dev/2006-January/060141.html>`__
[SJB]
---------------------
Updating ConfigParser
---------------------
The discussion about possible ConfigParser improvements continued,
with the typical failure to make any decisions.
As always, the options include small modifications to the existing
ConfigParser (e.g. allowing preservation of comments, order, and
whitespace), re-writing ConfigParser (perhaps based on existing
third-party versions), or providing a more sophisticated configuration
file module (either leaving ConfigParser as-is, or rewriting it to use
the new module).
Contributing threads:
- `ConfigParser to save with order
<http://mail.python.org/pipermail/python-dev/2006-January/059949.html>`__
- `Extension to ConfigParser
<http://mail.python.org/pipermail/python-dev/2006-January/060138.html>`__
- `YAML (was Re: Extension to ConfigParser)
<http://mail.python.org/pipermail/python-dev/2006-January/060264.html>`__
- `JSON (was: YAML)
<http://mail.python.org/pipermail/python-dev/2006-January/060269.html>`__
[TAM]
---------------------------------------
Introducing a basenumber abstract class
---------------------------------------
Alex Martelli proposed introducing a class, basenumber, along the
lines of the basestring class. The intention was to make it easier to
check whether or not something is a number. However, if inheriting
from basenumber was required for all new number-like objects, then the
duck-typing approach of simply implementing the appropriate interface
would no longer work. Also, since inheriting from multiple builtin
types is disallowed, a str subclass that needs to act like a number
(e.g. a symbolic type) would no longer be able to do so since it could
not also inherit from basenumber.
Guido suggested an __index__ method that would identify a type as
convertible into an integer, though without the loss of precision
allowed by __int__. More on this suggestion in the next summary.
Contributing threads:
- `basenumber redux
<http://mail.python.org/pipermail/python-dev/2006-January/059762.html>`__
- `index (was str with base)
<http://mail.python.org/pipermail/python-dev/2006-January/059827.html>`__
[SJB]
-----------------------------------
New Python website: beta.python.org
-----------------------------------
Skip Montanaro pointed out that Tim Parkin is heading up a `new
effort`_ to redesign the python.org site. The system is based on
content formatted primarily in ReST_ for easy editing, though to fully
render the pages a number of other tools are required. Tim hopes to
get these all wrapped up in setuptools_ and eggs_ so that anyone can
also see the fully rendered pages.
Also on the topic of webpage redesign, Steve Holden looked into
changing the sourceforge "Download Python" link to point to the right
place: http://www.python.org/download/. This link, however, cannot be
directly modified, so Martin v. Löwis put a small warning above it.
.. _new effort: http://beta.python.org/
.. _setuptools: http://peak.telecommunity.com/DevCenter/setuptools
.. _eggs: http://peak.telecommunity.com/DevCenter/PythonEggs
Contributing threads:
- `Python icon
<http://mail.python.org/pipermail/python-dev/2006-January/059839.html>`__
- `SourceForge Download Page, Subversion Home Page
<http://mail.python.org/pipermail/python-dev/2006-January/060144.html>`__
[SJB]
---------------------
Readline on OS X 10.4
---------------------
Thomas Heller has a problem building readline on OS X 10.4. This is a
known issue, the result of Apple shipping libedit symlinked to
readline rather than readline itself. You need to get a third party
copy of readline - Bob Ippolito made a _readline egg`_.
Alternatively, if LDFLAGS AND CPPFLAGS are set appropriately for
/opt/local/lib and opt/local/include, and the DarwinPorts copy of
readline is installed, then it will be found by setup.py.
Concerns about linking with readline (which is released under the GPL)
were raised, that explicitly requiring or checking for readline could
violate the licence. A suggestion was made that Python 3000 could
stop using readline and use an alternative instead.
.. _readline egg: http://python.org/pypi/readline
Contributing thread:
- `Building on OS X 10.4 fails
<http://mail.python.org/pipermail/python-dev/2006-January/059838.html>`__
[TAM]
-----------------------------
Yielding from a sub-generator
-----------------------------
Before PEP 342, there wasn't a big need for a shortcut to pass control
to a "sub-generator" because the following for-loop works well enough::
def main_generator():
...
for value in sub_generator():
yield value
but now that yield can return a value, that value might have to be
passed into sub_generator(), not to mention exceptions. Guido felt
that a syntactic solution is needed, if the problem is important
enough to be solved; a suggestion was "yield from sub_generator()".
Contributing thread:
- `yield back-and-forth?
<http://mail.python.org/pipermail/python-dev/2006-January/059955.html>`__
[TAM]
----------------------------------------
Using the Win32 API for stat/fstat/wstat
----------------------------------------
Martin v. Löwis wanted to switch the code for stat/fstat/wstat from
using msvcrt to the Win32 API. However, currently, when WindowsError
is raised, the errno attribute must be interpreted as a Win32 error
instead of as an errno.h error as in its superclass, OSError. The
Win32 API provides different error codes, so using these for the errno
attribute could cause some code breakage. The options seemed to be
either to break WindowsError and use the new Win32 API error codes, or
to introduce a new windows_error attribute to hold the additional
information. No decision had been made at the time this summary was
written.
Contributing thread:
- `"DOS" error codes, WindowsError, and errno
<http://mail.python.org/pipermail/python-dev/2006-January/060243.html>`__
[SJB]
---------------------------
Making timeit easier to use
---------------------------
Connelly Barnes was concerned that the default behavior of the timeit
module was not very useful. Since timing a function seems like the
most common use of timeit, it should be a simple operation, not a
method call with a string describing how to import the function and
then another string describing how to call it. Also, the default
behavior of 1 million iterations is not useful for any code that
cannot be repeated that many times. Instead, the number of iterations
should be calibrated as it is in the command-line version. Nick
Coghlan provided an implementation for these improvements, but it was
unclear whether or not those changes would be applied to the module.
Contributing thread:
- `timeit module
<http://mail.python.org/pipermail/python-dev/2006-January/059769.html>`__
[SJB]
---------------------------
Removing deprecated modules
---------------------------
The regex, regsub and timing modules have been obsolete since Python
2.0, but are still importable in Python 2.4 (regex and regsub both
generate a deprecation warning). Skip Montanaro asked when these
would be removed, and Guido said that they should be as soon as
possible.
Contributing thread:
- `When will regex really go away?
<http://mail.python.org/pipermail/python-dev/2006-January/060022.html>`__
[TAM]
================
Deferred Threads
================
- `Compiler warnings
<http://mail.python.org/pipermail/python-dev/2006-January/060253.html>`__
- `Octal literals
<http://mail.python.org/pipermail/python-dev/2006-January/060262.html>`__
==================
Previous Summaries
==================
- `os.path.getmtime on Windows
<http://mail.python.org/pipermail/python-dev/2006-January/059756.html>`__
- `Birkenfeld's gone
<http://mail.python.org/pipermail/python-dev/2006-January/059757.html>`__
- `Ph.D. dissertation ideas?
<http://mail.python.org/pipermail/python-dev/2006-January/059759.html>`__
- `Names matter.
<http://mail.python.org/pipermail/python-dev/2006-January/059767.html>`__
- `New PEP: Using ssize_t as the index type
<http://mail.python.org/pipermail/python-dev/2006-January/059913.html>`__
- `[PATCH] Fix dictionary subclass semantics whenused as global
dictionaries <http://mail.python.org/pipermail/python-dev/2006-January/060024.html>`__
- `from __future__ syntax changed
<http://mail.python.org/pipermail/python-dev/2006-January/060245.html>`__
===============
Skipped Threads
===============
- `PEP 247 and hashlib
<http://mail.python.org/pipermail/python-dev/2006-January/059761.html>`__
- `[Python-checkins] r42064 - python/trunk/Lib/logging/handlers.py
<http://mail.python.org/pipermail/python-dev/2006-January/059777.html>`__
- `pystate.c changes for Python 2.4.2
<http://mail.python.org/pipermail/python-dev/2006-January/059778.html>`__
- `computed goto's in ceval loop
<http://mail.python.org/pipermail/python-dev/2006-January/059865.html>`__
- `subwcrev.exe
<http://mail.python.org/pipermail/python-dev/2006-January/059875.html>`__
- `[Python-checkins] r42090 - in python/trunk: Modules/getbuildinfo.c
PCbuild/make_buildinfo.vcproj PCbuild/pcbuild.sln
PCbuild/pythoncore.vcproj
<http://mail.python.org/pipermail/python-dev/2006-January/059883.html>`__
- `Additions to the functional module
<http://mail.python.org/pipermail/python-dev/2006-January/059926.html>`__
- `PEP 343 and __context__()
<http://mail.python.org/pipermail/python-dev/2006-January/059943.html>`__
- `site triggering a bug in urllib2
<http://mail.python.org/pipermail/python-dev/2006-January/059947.html>`__
- `[Python-checkins] r42116 -
python/branches/release24-maint/Lib/unittest.py
<http://mail.python.org/pipermail/python-dev/2006-January/059964.html>`__
- `stabilizing builds
<http://mail.python.org/pipermail/python-dev/2006-January/060012.html>`__
- `building a module catalogue with buildbot
<http://mail.python.org/pipermail/python-dev/2006-January/060013.html>`__
- `Weekly Python Patch/Bug Summary
<http://mail.python.org/pipermail/python-dev/2006-January/060015.html>`__
- `Weekly Python Patch/Bug Summary (Revised)
<http://mail.python.org/pipermail/python-dev/2006-January/060016.html>`__
- `Long-time shy failure in test_socket_ssl
<http://mail.python.org/pipermail/python-dev/2006-January/060035.html>`__
- `[Python-checkins] r42185 -
python/trunk/Lib/test/test_socket_ssl.py
<http://mail.python.org/pipermail/python-dev/2006-January/060082.html>`__
- `(no subject)
<http://mail.python.org/pipermail/python-dev/2006-January/060259.html>`__
========
Epilogue
========
This is a summary of traffic on the `python-dev mailing list`_ from
January 16, 2006 through January 31, 2006.
It is intended to inform the wider Python community of on-going
developments on the list on a semi-monthly basis. An archive_ of
previous summaries is available online.
An `RSS feed`_ of the titles of the summaries is available.
You can also watch comp.lang.python or comp.lang.python.announce for
new summaries (or through their email gateways of python-list or
python-announce, respectively, as found at http://mail.python.org).
This python-dev summary is the 12th written by
the python-dev summary python-dev summary duo of Steve Bethard and Tony Meyer .
To contact us, please send email:
- Steve Bethard (steven.bethard at gmail.com)
- Tony Meyer (tony.meyer at gmail.com)
Do *not* post to comp.lang.python if you wish to reach us.
The `Python Software Foundation`_ is the non-profit organization that
holds the intellectual property for Python. It also tries to advance
the development and use of Python. If you find the python-dev Summary
helpful please consider making a donation. You can make a donation at
http://python.org/psf/donations.html . Every cent counts so even a
small donation with a credit card, check, or by PayPal helps.
--------------------
Commenting on Topics
--------------------
To comment on anything mentioned here, just post to
`comp.lang.python`_ (or email python-list(a)python.org which is a
gateway to the newsgroup) with a subject line mentioning what you are
discussing. All python-dev members are interested in seeing ideas
discussed by the community, so don't hesitate to take a stance on
something. And if all of this really interests you then get involved
and join `python-dev`_!
-------------------------
How to Read the Summaries
-------------------------
That this summary is written using reStructuredText_. Any unfamiliar
punctuation is probably markup for reST_ (otherwise it is probably
regular expression syntax or a typo :); you can safely ignore it. We
do suggest learning reST, though; it's simple and is accepted for
`PEP markup`_ and can be turned into many different formats like HTML
and LaTeX. Unfortunately, even though reST is standardized, the
wonders of programs that like to reformat text do not allow us to
guarantee you will be able to run the text version of this summary
through Docutils_ as-is unless it is from the `original text file`_.
.. _python-dev: http://www.python.org/dev/
.. _SourceForge: http://sourceforge.net/tracker/?group_id=5470
.. _python-dev mailing list: http://mail.python.org/mailman/listinfo/python-dev
.. _c.l.py:
.. _comp.lang.python: http://groups.google.com/groups?q=comp.lang.python
.. _PEP Markup: http://www.python.org/peps/pep-0012.html
.. _Docutils: http://docutils.sf.net/
.. _reST:
.. _reStructuredText: http://docutils.sf.net/rst.html
.. _PSF:
.. _Python Software Foundation: http://python.org/psf/
.. _original text file:
http://www.python.org/dev/summary/2006-01-16_2006-01-31.rst
.. _archive: http://www.python.org/dev/summary/
.. _RSS feed: http://www.python.org/dev/summary/channews.rdf
1
0
There's a new SoC mailing list.
soc2006(a)python.org
You can sign up here: http://mail.python.org/mailman/listinfo/soc2006
This list is for any SoC discussion: mentors, students, idea, etc.
Student can submit applications starting May 1, so now is the time to
get students interested in your ideas!
Please pass this information along.
Cheers,
n
1
0
Hello all,
I have released version 0.6 of my functional module, a collection of
higher-order and functional programming tools for Python. Currently
offered are tools for function composition, partial function
application, plus flip, foldl, foldr, scanl and scanr functions.
Two version of the release are available: one is written in pure
Python and aims for maximum readability and portability. The other is
coded as a C extension module and is focused on raw performance.
Where to get it:
#########
functional is available from the project's website at
http://oakwinter.com/code/functional/download/
and from the Python Package Index at
http://cheeseshop.python.org/pypi/functional.
Both source tarballs and Python Eggs are available for both the pure
Python and C releases. Eggs are available for Python versions 2.3, 2.4 and 2.5.
Release Notes
########
+ flip will now reverse all non-keyword arguments, as opposed to
simply reversing the first two as it did in version 0.5 (by popular
request).
+ functional.compose now comes with an optional unpack parameter to
make up for the fact that Python functions aren't fully curried.
The unpack parameter means that you can now do something like this with compose:
>>> f(*g(*arg,**kw))
i.e., automatically unpacking g's return value and passing the result to f.
To get this functionality, you'd write something like:
>>> compose(f, g, unpack=True)(*args, **kwargs)
This was impossible with functional 0.5.
+ Weakref support has been added to flip and compose objects in the C version.
+ Sundry performance improvements for the C implementation.
As always, feedback welcome!
Collin Winter
1
0