On Wed, Jun 14, 2006 at 03:33:31PM +1000, Tim Leslie wrote:
[...]
> You can have generators which look like list comprehensions, but they
> still have the same problem of the if statement only acting as a
> filter, not a stopping condition. If you wanted it to work you'd have
> to shift your condit
Tim Leslie wrote:
> Here's my current musings on "new python syntax features that
> would be really, really, cool".
> My use case for this was doing stuff with prime numbers where
> you'd want to take the first however many from a big list of
> primes, e.g[3].
>
> def is_prime(n, primes):
>
On 6/14/06, Jamie Wilkinson <[EMAIL PROTECTED]> wrote:
This one time, at band camp, Tim Leslie wrote:
>On 6/14/06, Jamie Wilkinson <[EMAIL PROTECTED]> wrote:
>>List comprehensions!
>>
>>>def is_prime(n, primes):
>>> """ primes is a list of primes where sqrt(n) <= max(primes) < n"""
>>> for p
On 14/06/2006, at 3:20 PM, Jamie Wilkinson wrote:
This one time, at band camp, Tim Leslie wrote:
On 6/14/06, Jamie Wilkinson <[EMAIL PROTECTED]> wrote:
List comprehensions!
def is_prime(n, primes):
""" primes is a list of primes where sqrt(n) <= max(primes) <
n"""
for p in primes whi
This one time, at band camp, Tim Leslie wrote:
>On 6/14/06, Jamie Wilkinson <[EMAIL PROTECTED]> wrote:
>>List comprehensions!
>>
>>>def is_prime(n, primes):
>>> """ primes is a list of primes where sqrt(n) <= max(primes) < n"""
>>> for p in primes while p*p <= n:
>>> if n % p == 0:
>>>
On 6/14/06, Jamie Wilkinson <[EMAIL PROTECTED]> wrote:
List comprehensions!
>def is_prime(n, primes):
> """ primes is a list of primes where sqrt(n) <= max(primes) < n"""
> for p in primes while p*p <= n:
> if n % p == 0:
> return False
> return True
>
>Does this look like
This one time, at band camp, Tim Leslie wrote:
>Here's my current musings on "new python syntax features that would be
>really, really, cool".
>
>A common idiom[1] when looping is to do something like:
>
>for i in somelist:
> if not condition:
> break
> do_stuff()
>
>Wouldn't it be cool[2
On 14/06/2006, at 10:48 AM, Tim Leslie wrote:
Here's my current musings on "new python syntax features that would be
really, really, cool".
A common idiom[1] when looping is to do something like:
for i in somelist:
if not condition:
break
do_stuff()
Wouldn't it be cool[2] if inst