Re: "number-in-base" ``oneliner''
Bengt Richter <bokr@oz.net> wrote:
[color=blue]
> 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 ;-)[/color]
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
Bengt Richter <bokr@oz.net> wrote:
[color=blue]
> 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 ;-)[/color]
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
Comment