

Python’s httplib uses print for debugging. Oh, it hurts… - ihodes
http://blog.n01se.net/?p=213

======
TimothyFitz
This code is almost as old as the web itself. The debug loglevel stuff was in
the original check-in in 1994, by Guido himself:
[http://svn.python.org/view/python/trunk/Lib/httplib.py?revis...](http://svn.python.org/view/python/trunk/Lib/httplib.py?revision=3849&view=markup)

A simple find-replace would be enough to switch it over to python's built-in
logging module.

------
Estragon
Fixing this is a minor rototilling exercise. Just change the print statements
to something more sensible and submit a patch.

~~~
wildjim
But I've seen this sort of crap in all sorts of "standard" lib's in Python,
and it never seems to get cleaned-up...

... I really hate having to use Python.

~~~
rue
> _But I've seen this sort of crap in all sorts of "standard" lib's in Python,
> and it never seems to get cleaned-up..._

I assume you meant to write "I've seen this sort of crap and _written patches
for it_ "?

~~~
i386
Thank you. This is the wonderful thing about opensource - you can fix it if
its broken - its the price you pay for getting it for nothing.

~~~
nailer
That's not a price, it's an additional benefit.

------
gxti
It's a debugging feature. It scratched a particular itch that a particular
developer had at the time that they wrote it. If it weren't there at all,
would this blog post still have been written?

------
jokull
Check out restkit (<http://github.com/benoitc/restkit>) - much better then
urllib/2 or httplib/2

~~~
brodie
What's wrong with httplib2?

~~~
jokull
It actually uses httplib1 under the hood which I've had weird problems with
(even when using the httplib2 abstraction). Restkit has a better interface and
really cool filters for such things as proxies.

------
ErrantX
Httplib has caused me headaches in the past (admittedly due to a very specific
and convoluted architecture).

But I wouldn't call it bad... the point made here is simply an issue of not
considering scale - in this case easily fixed.

I _would_ call it slow.

------
japherwocky
Curious what you're using httplib for? 80% chance you're reinventing a wheel.

~~~
fauigerzigerk
Sometimes reinventing something as simple as the wheel is more robust than
adapting someone elses equally half baked and unmaintained attempt at wheel
reinvention from 2002.

