[Python-Dev] Rework nntlib?

Antoine Pitrou solipsis at pitrou.net
Tue Sep 14 12:40:29 CEST 2010

On Tue, 14 Sep 2010 20:30:14 +1000
Nick Coghlan <ncoghlan at gmail.com> wrote:
> On Tue, Sep 14, 2010 at 8:17 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> >
> > Hello,
> >
> > Like the email package, nntplib in py3k is broken (because of
> > various bytes/str mismatches; I suppose the lack of a test suite didn't
> > help when porting).
> >
> > I would like to take the opportunity to improve the API a bit; no heavy
> > re-architecting, but simply a bunch of changes to make it higher-level.
> > Is it acceptable?
> >
> > (and, yes, I would add a test suite)
> This is the kind of question that's hard to answer in the abstract. In
> principle it sounds like a reasonable idea, but in practice, if the
> old API works correctly for 7-bit ASCII, it should probably remain
> available (even if it's nominally broken for Unicode and 8-bit ASCII).

The current module is broken in py3k. I suppose it is still usable for
things like fetching group descriptions, but you can't e.g. read

Also, http://bugs.python.org/issue9360 mentions that API changes were
discussed by Brett and the OP at EuroPython (I wasn't there):

“Change API methods to return strings instead of bytes. This breaks API
compatibility, but given that the parameters need to be passed as
strings and many of the returned values would need to be passed to
other API methods, I consider the current API to be broken. I've
discussed this with Brett at the EuroPython sprint, and he agrees.”

My changes build on the patch proposed on this issue and add further

Yes, the new API could be checked in as "nntplib2" instead. I am a
bit uneasy with that, though, since 1) the original nntplib would still
be broken 2) the changes I have in mind don't seem enough to warrant
such a grandiloquent naming :-)



More information about the Python-Dev mailing list