On Sun, Oct 19, 2008 at 1:44 PM, James Mills
<[EMAIL PROTECTED]> wrote:
> On Sun, Oct 19, 2008 at 1:30 PM, Steven D'Aprano
> <[EMAIL PROTECTED]> wrote:
>> for x in (2**i for i in xrange(10)):
>>    print x
>
> This is by far the most concise solution I've seen so far.
> And it should never be about conserving code.
> Also, Python IS NOT C (to be more specific: Python
> is not a C-class language).

Also, if the OP is finding himself writing such manual
and mundane looking loops, he/she should reconsider
what it is he/she is doing. You would normally want
to iterate (vs. loop) over a sequence of items.

--JamesMills

-- 
--
-- "Problems are solved by method"
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to