On Jun 14, 2005, at 2:25 AM, Raymond Hettinger wrote:

>> def readby(inp, blocksize=1024):
>>      while True:
>>          data = inp.read(blocksize)
>>          if not data:
>>              break
>>          yield data
>>
>> for data in readby(inp, blocksize):
>>      . . .
>>
>
> readby() relies on the existence of a read() method for inp.
> itertools work with generic iterators, not ones with a specific API.
> Law of Demeter.

islice depends on __getitem__.

-bob

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to