On Thu, 20 Aug 2009 16:51:00 -0700, Aahz wrote:

> In article <mailman.143.1250793404.2854.python-l...@python.org>,
> Benjamin Kaplan  <benjamin.kap...@case.edu> wrote:
>>On Thu, Aug 20, 2009 at 2:13 PM, David C Ullrich<dullr...@sprynet.com>
>>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]




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

Reply via email to