[Python-Dev] IO implementation: in C and Python?

Terry Reedy tjreedy at udel.edu
Fri Feb 20 21:26:10 CET 2009


Guido van Rossum wrote:
> On Fri, Feb 20, 2009 at 4:01 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>> Georg Brandl <g.brandl <at> gmx.net> writes:
>>> I just hope everyone updates both versions when making changes to IO.
>> My proposal is just organizational, it is neutral in terms of whether or not the
>> Python version is correctly maintained.
> 
> I worry that with your proposal people are once again going to import
> the pure Python version where they shouldn't. Maybe _pyio.py would
> work though?

 From a user perspective, continuity of 'import xyz' importing the 
currently best implementation is what is important, even if that 
switches back and forth.

>> We can hope that the IO lib *semantics* won't change too much in the future
>> (although there is an IMO legitimate request for a setblocking() method:
>> http://bugs.python.org/issue949667). On the other hand, I don't expect anyone to
>> willingly use the Python version if the C version is available.
> 
> Hoping that modules won't evolve is futile. The concern for divergence
> is real. Unit-testing both with the same tests might be the solution.

It seems to me that starting new features with a new test and 
prototyping in the Python version should mostly avoid the problem. 
Keeping the Python version allows non-C Pythoneers to contribute to such 
efforts.  (As opposed to fixing a C-only bug.)  If the Python version is 
ahead at the time of a release, the Python version could be reverted to 
being a master version that import the C version for most but not all 
functions.

tjr




More information about the Python-Dev mailing list