On Sun, 19 Oct 2008 03:17:51 -0700, John Machin wrote:

> Steven D'Aprano wrote:
> 
>> On Sat, 18 Oct 2008 20:45:47 -0700, John Machin wrote:
>>
>> > On Oct 19, 2:30 pm, Steven D'Aprano <[EMAIL PROTECTED]
>> > cybersource.com.au> wrote:
>> > [snip]
>> >> making your code easy to read and easy to maintain is far more
>> >> important.
>> >>
>> >> for x in (2**i for i in xrange(10)):
>> >>     print x
>> >>
>> >> will also print 1, 2, 4, 8, ... up to 1000.
>> >
>> > I would say up to 512; perhaps your understanding of "up to" differs
>> > from mine.
>>
>> Well, mine is based on Python's half-open semantics: "up to" 1000
>> doesn't include 1000, and the highest power of 2 less than 1000 is 512.
> 
> We're talking about an English sentence, not a piece of Python code.
> When you say "I'm taking the train to X", do you get off at the station
> before X, as in "getting off at Redfern"?

But I don't say "I'm taking the train UP TO X".

Intervals in English are often ambiguous, which is why people often 
explicitly say "up to and including...". But in this specific case, I 
don't see why you're having difficulty. Whether 1000 was included or not 
makes no difference, because 1000 is not a power of 2.


-- 
Steven
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to