[Python-Dev] About code comments policy (and Handler order in urllib2)

Facundo Batista facundo at taniquetil.com.ar
Mon Mar 5 16:44:01 CET 2007


One question and one answer (this is a balanced post, :p).

The question is what to do when we found a question in a code. Reading
urllib2 I found:

  # XXX why does self.handlers need to be sorted?

I found the answer, so I deleted that line, and added a comment in that
place just to clarify. 

Shall I do something else? Like posting here the answer?

BTW, the answer to that question is that the handlers must work in an
specific order. The order is specified in each Handler (handler_order
class attribute), and BaseHandler has __lt__ defined using that
attribute. So, OpenerDirector, keeps self.handler ordered with
bisect.insort.

Regards,

-- 
.   Facundo
.
Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/





More information about the Python-Dev mailing list