"number-in-base" ``oneliner''

Alex Martelli aleaxit at yahoo.com
Sun Oct 31 17:19:26 EST 2004


Bengt Richter <bokr at oz.net> wrote:

> Not sure if I got filtered out replying to myself, what with an accidental
> dupe and all the incremental changes and corrections ;-/ Anyway, I guess
> you could say there's a "while" implicit in iter(f, sentinel) that you
> _can_ do within a list comprehension ;-)

Yep, excellent suggestion, tx.  I went with the logarithm suggestion,
but in other cases the two-arguments iter could surely be the best way
to hide a 'while callable() != sentinel:' in a list comprehension!-)


Alex



More information about the Python-list mailing list