Silly question

David C Ullrich dullrich at
Fri Aug 21 21:45:55 CEST 2009

On Fri, 21 Aug 2009 14:40:30 -0500, David C Ullrich wrote:

> On Thu, 20 Aug 2009 16:51:00 -0700, Aahz wrote:
>> In article <mailman.143.1250793404.2854.python-list at>,
>> Benjamin Kaplan  <benjamin.kaplan at> wrote:
>>>On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich<dullrich at>
>>>wrot= e:
>>>> I just noticed that
>>>> sequence[i:j:k]
>>>Well, I got some good news and some bad news. According to the docs, it
>>>existed in 1.4 but the built-in sequences didn't support it until 2.3.
>>>It's not used that often anyway so you haven't been missing much.
>> Except that it's canonical for one specific operation:
>> 'reverseme'[::-1]
> It's like you guys are a bunch of programmers or something:
> from math import sqrt
> def Primes(n):
>   """Return a list of the primes < n""" sieve = range(n)
>   for k in range(2,int(sqrt(n))+2):
>     sieve[::k] = [1]*((n+k-1)/k)
>   return [p for p in sieve if p > 1]

Oops. Should have tested that a little more carefully
before posting. No time to fix it right now, customer just
got here. Let's just say we're looking for the primes
between sqrt(n) and n...

More information about the Python-list mailing list