[Python-Dev] python-dev Summary for 2004-06-16 through 2004-06-30 [draft]

Brett Cannon bac at OCF.Berkeley.EDU
Fri Jul 2 02:31:55 CEST 2004

For as long as I can remember, when I have sent out a rough draft of a 
summary, it has been delayed long enough that I had a bunch of emails 
already for the next summary.  Well everyone, I managed to finally have 
my python-dev folder have an email count less than the number of fingers 
I have on a hand (and I still have all of my fingers).  You can thank a 
hiccup in my workload for that (and thus me not earning any money 
today).  It almost seems wrong that I don't have enough emails to cause 
a scrollbar to appear.  =)

Won't send this out any earlier than the 4th so you have at least until 
then to send in corrections.


Summary Announcements
The trouble plaguing mail.python.org mid-month have been cleared up.  It 
had led to some rather delayed emails so if you sent one in and it was 
ignored for no good reason you might want to consider bringing the topic 
back up.

In the little comment made by the summary count, I questioned whether 
that count was correct.  Turns out it was off by one; this is the true 
forty-third semi-monthly summary by me (month-long summaries I counted 
twice).  So counting the two week span that I took off when Raymond 
Hettinger summarized for a week way back in October 2002 (still waiting 
for the second week, Raymond  =) I have been doing this for 22 months 
straight.  And yet after all of that email I still have my eye sight. 

Decimal type still chugging along
Facundo Batista updated `PEP 327`_ with what are close to the last 
issues for the PEP.  There has also been some recent activity in the 
sandbox on the package.  It could still make it into 2.4 ...

And it has!  As I wrote this Decimal.py graduated kindergarten, left the 
sandbox, and is now out on the playground with the rest of Lib.  Play nice.

.. _PEP 327: http://www.python.org/peps/pep-0327.html

Contributing threads:
   - `PEP 327 (Decimal data type) updated and status 

CVS docs, now in handy tarball form
Fred Drake has tweaked the script that puts up new versions of the CVS 
docs to also upload a tarball of the HTML.  You can find that and links 
to the other in-development documentation at 
http://www.python.org/dev/doc/ .

Contributing threads:
   - Downloadable HTML from the trunk 

Proposed additions to heapq API
Raymond Hettinger proposed adding two new functions to the heapq API. 
heappushpop() would take an item, push it on to the heap, and then pop 
off the smallest value.  heapiter() would return a destructive iterator. 
  The actual implementation of heappushpop() got the most discussion.

No finally decision has been made, so if either function sounds good to 
you then do speak up.

Contributing threads:
   - `heapq API 

Consolidation of CJK codecs
Hye-Shik Chang consolidated the various CJK codecs into various files 
and managed to save some space in terms of the files themselves.  As M-A 
Lemburg pointed out, though, there was no need to in terms of loading 
size since most linkers mmap only what is needed to run.

Contributing threads:
   - `Planned updates for cjkcodecs before 2.4a1 

Function decorators in 2.4 ... maybe
The topic of whether function decorators would go into 2.4, and if so 
with what syntax, continued to be debated from the `last summary`_. 
Beyond reference implementations, nothing really changed.  Overall 
people agreed they would like to see it in 2.4 using whatever syntax 
Guido chooses (and he has three in mind, so no more suggestions!), but 
if he felt the need to wait then functionality would be held off for 2.5 .

Contributing threads:
   - `functions decorators in 2.4? 
   - `decorators and 2.4 

Making ``''.join(list_of_strs)`` an inconsequential idiom
As most people know, concatenating strings in a 'for' loop is a bad 
idea; the idiom you are supposed to use is to store the strings you want 
to concatenate in a list and the pass it to ``''.join(list_of_strs)``. 
This is because string addition requires allocating memory for the size 
of the concatenation and then copying from both strings into the new 
memory.  The constant new memory allocation is costly when you have a 
loop that goes for more than a few iterations.

Raymond Hettinger suggested altering the str object to have a pointer 
that would point to any strings that were meant to be treated as 
concatenated to the current string.  The problem with this is that it 
grew the str object the size of a pointer and that is costly for a 
object as common as string.

Armin Rigo gave this challenge a shot and ended up with a bunch of code 
that special-cases the BINARY_ADD opcode.  Neither solution as been 
accepted at this moment.

Contributing threads:
   - `Wild Idea for the Year 
   - `Building strings with += 

Possible exposure of universal newlines outside of the file object
Scott David Daniels suggested a new itertools functioned that would work 
like universal newlines but for strings or files already opened without 
universal newlines turned on.  People were receptive to the idea, just 
not for putting it into itertools.  Suggestions ranged from exposing the 
functionality as a static method of the file type to sticking into 
'string'.  No conclusion of where to put it was reached.

Contributing threads:
   - `Possible addition to itertools 

NOP does exist I tell you!
Raymond Hettinger asked if anyone objected to adding a no-op opcode 
(aptly named NOP).  People said nope (see?  "NOP", "nope", sound the 
same?  <eddie izzard>Forget it</eddie izzard>).  So it's in.

Contributing threads:
   - `NOP 

Yes, the Windows binary for 2.4 will use VC 7.1
Yes, Python 2.4 will use VC 7.1 .  No, we are not going to have a VC 6 
binary (you can build it if you want, though).  No, distributing the 
needed DLLs with the installer go against the GPL (even though the 
codebase is not GPL but more BSD and no one from the FSF has told it 
including the DLLs is wrong).  Maybe, we will use Martin v. Loewis' MSI 
installer, maybe not (still being debated as this was being written).

Contributing threads:
   - `VC 7.1 maintenance? 

Possible itertools additions
Raymond Hettinger suggested two itertools additions; count_elements and 
pairswap.  The former counts the number of times an item appears in the 
passed-in iterable and returns pairs of the count and the item.  The 
latter takes an iterable that returns pairs and returns and iterable 
that returns those pairs swapped.

In the end people didn't see the need for pairswap.  People did want 
count_elements, but not as an iterator but as something that returned a 
dictionary.  It was suggested as both a class method of dict and as a 
new bucket type that could possibly go into the 'collections' module. 
No final decisions yet, though.

Contributing threads:
   - `Candidate Itertools 

Gettin' PEP 292 into 2.4
Barry Warsaw brought up the point that `PEP 292`_ was slated to go into 
2.4 (it's currently in the sandbox).  The two biggest questions was the 
names of the new functions and where to stick them.  The name issue was 
not quite as bad once Barry explained the reasoning behind the existing 

Where to put the code, though, was not so easily dealt with.  The 
original idea (which Barry and I came up with, so I am biased here) was 
to turn the string module into a package with the new code going there. 
  Barry also pointed out that the code in 'string' that is deprecated 
and will eventually go away can be moved into an individual module that 
can just simply be deleted from the package later and change a single 
``import *`` line in __init__.py for the package.

Not everyone saw the utopia Barry and I were trying to build.  People 
suggested just not bothering with turning 'string' into a package. 
Still others suggested a new package altogether; 'stringlib' and 'text' 
were suggested names.  It's still not resolved.

.. _PEP 292: http://www.python.org/peps/pep-0292.html

Contributing threads:
   - `PEP 292 for Python 2.4 

Having u.encode() return something other than strings
Currently unicode.encode() returns only strings.  M-A Lemburg wanted to 
lift this restriction.  Guido pointed out that this could possibly cause 
problems for type inferencing since the return type would vary based on 
an argument (which made me happy since my masters thesis ties into this 
stuff).  A compromise was reached where the method will only return 
8-bit or Unicode strings; basically only subtypes of basestring.

Contributing threads:
   - `Allowing u.encode() to return non-strings 

Comparing floats and longs is a pain
Basically this all boiled down to this (quoted from Michael Chermside): 
"when comparing a long with a float where the exponent is larger than 
the precision, that the float should be treated as if it were EXACTLY 
EQUAL TO <coefficient>*2^<exponent>, instead of trying to treat it as 
some sort of a range."  Guido said he would like to see this in 2.4 if 
someone would write up the code and commit it.

Contributing threads:
   - `Comparing heterogeneous types 

German and Turkish docstrings from pydoc
Martin v. Loewis is currently trying to figure out where to put partial 
translations of docstrings in the stdlib for pydoc to use as appropriate.

Contributing threads:
   - `Including translated doc strings in 2.4 

What to do when 'raise' is called after the last exception was caught
What should happen if you call 'raise' when you already caught the last 
exception that was raised?  People debated what the official docs said. 
  Seemed to coalesce to be what ever the last exception was; caught or 
not.  This ties into being what exception was currently stored.

Contributing threads:
   - `Re-raise in absence of an "active" exception 

Can you help with cleaning up the Demo directory?
The Demo directory is in need of some TLC.  A bunch of modules in there 
are out of date and could use an update to current Python abilities.  If 
you care to help by submitting patches to update the code that would be 
great.  There is a large swath of code in there varying from extremely 
simple to involved so if the mood ever strikes you there will be 
something for everyone.

And if you attend the next Python Bug Day you can also work on it then.

Contributing threads:
   - `What can we do about dealing with the Demo directory? 

No more expected test failures on Windows for 2.4
The bsddb tests are now expected to pass on Windows.  What this means is 
that failures are no longer the norm on Windows for the Python 
regression testing suite.

Contributing threads:
   - `Joy in Berkeley Windowsland 

Getting accessible local dicts per thread
Jim Fulton wanted to expose the pre-thread local dict .  He has an 
implementation going that he is going to play with and work the kinks 
out of.  After that the code will most likely be committed.

Contributing threads:
   - `Proposal: thread.get_dict 

Where to stick SHA-256
Someone contributed a patch for adding SHA-256 support.  A discussion 
built up over where to put it, if at all.  It's still going on at this 
moment.  Most people seem to agree that if it is included, it should 
either just be another function in the sha module or that sha.sha() 
should accept an optional argument specifying how many bits to use for 
the hash.

Contributing threads:
   - `SHA-256 module 

Making weakrefs subclassable
Fred Drake has a patch to add the ability to subclass weakrefs.  He 
wasn't sure if there would be a performance penalty though.  But Tim 
Peters stepped up and said there wouldn't be.  So it looks like it 
should go in shortly.

Contributing threads:
   - `making weakref.ref objects subclassable 

More information about the Python-Dev mailing list