Hacker News new | comments | ask | show | jobs | submit login
Python’s httplib uses print for debugging. Oh, it hurts… (n01se.net)
27 points by ihodes on July 4, 2010 | hide | past | web | favorite | 15 comments



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...

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


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


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.


> 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"?


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.


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


Every language and library has its warts and Python is no exception. By and large though, I'd say that Python's standard library is the best part of the language. Sure there are a lot of things like this out there, but for the most part, the standard library "just works" the way it's supposed to.


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?


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


What's wrong with httplib2?


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.



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.


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


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.




Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: