[issue3243] Support iterable bodies in httplib

Senthil Kumaran report at bugs.python.org
Thu Dec 2 03:23:20 CET 2010


Senthil Kumaran <orsenthil at gmail.com> added the comment:

On Wed, Dec 01, 2010 at 02:56:56PM +0000, Xuanji Li wrote:
> orsenthil: Hi, i don't quite understand why iter() needs to be
> called explicitly on data? As I understand it, if data is an
> iterable then you can use a for loop on it directly.
> 

The reasoning I followed was, data is an "Iterable" (a collection) and
you get an "Iterator" by passing via iter(). And you send the items by
looping over the iterator.

Honestly, I am not sure if iter is needed here too. I thought it was
not needed too, when you determine it is an Iterable and iterate over
it using the for loop. But I kept the iter() method just to create an
instance and send it.

Antoine, which would be the correct/ better?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3243>
_______________________________________


More information about the Python-bugs-list mailing list