2013/4/6 João Bernardo <jbvsmo@gmail.com>:
> Isn't it justNot really:
>
> divmod(total, step)
>
> João Bernardo
>>> list(chunks(13, 4))
[4, 4, 4, 1]
>>> divmod(13, 4)
(3, 1)
Literally chunks() keeps yielding 'step' until 'total' is reached and
makes sure the last yielded item has the correct remainder.
--- Giampaolo
https://code.google.com/p/pyftpdlib/
https://code.google.com/p/psutil/
https://code.google.com/p/pysendfile/
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
http://mail.python.org/mailman/listinfo/python-ideas