Gregor Lingl said unto the world upon 2005-03-18 19:57:
Hi Danny!
Preliminary remark: I know that "beautiful" and "beauty"
are concepts very seldom applied to computer programs or
programming languages. I suppose mainly because they are
to a large extent a matter of taste ...
Hi Gregor and all,
Tho
Pierre Barbier de Reuille wrote:
def sieve( max ):
max_val = int( sqrt( max ) )
s = Set(xrange( 4, max, 2 ))
for i in xrange( 3, max_val, 2 ):
s.update( xrange( 2*i, max, i ) )
return [ i for i in xrange( 2, max ) if i not in s ]
just for grins, here is the same (mostly) code in haskell
Concerning my previous posting - perhaps it
would suffice to summarize:
While Python is a language for the "pragmatic" lover,
Scheme is much more "fundamentalistic".
(thought-) *PROVOKING*?
Gregor
___
Tutor maillist - Tutor@python.org
http://mail.pytho
Hi Danny!
Preliminary remark: I know that "beautiful" and "beauty"
are concepts very seldom applied to computer programs or
programming languages. I suppose mainly because they are
to a large extent a matter of taste ...
Nevertheless: regardeless of the fact that I'm not a very
skilled scheme-progr
Hi all of you!
Many thanks for your remarks, ideas and experiments.
When I posted my input yesterday:
[x for x in range(2,100) if not [y for y in range(2,x) if x%y==0]]
my intention was indeed to find a "shortest" a program, disregarding
efficiency. Thus range instead of xrange etc.
(About one year
On Mar 18, 2005, at 1:02 PM, Christopher Weimann wrote:
On 03/18/2005-10:35AM, Mike Hall wrote:
A caret as the first charachter in a class is a negation.
So this [^\s]+ means match one or more of any char that
isn't whitespace.
Ok, so the context of metas change within a class. That makes sense,
bu
On 03/18/2005-10:35AM, Mike Hall wrote:
> >
> > A caret as the first charachter in a class is a negation.
> > So this [^\s]+ means match one or more of any char that
> > isn't whitespace.
> >
>
> Ok, so the context of metas change within a class. That makes sense,
> but I'm unclear on th
On Mar 18, 2005, at 9:27 AM, Christopher Weimann wrote:
On 03/17/2005-10:15AM, Mike Hall wrote:
Very nice sir. I'm interested in what you're doing here with
the caret metacharacter. For one thing, why enclose it and the
whitespace flag within a character class?
A caret as the first charachte
Kent Johnson said unto the world upon 2005-03-18 07:35:
Brian van den Broek wrote:
Kent Johnson said unto the world upon 2005-03-17 20:44:
The multiple inheritance from MyNode and Toolkit.NodeX is a smell. I
guess you do this because you want to override methods of
Toolkit.Node as well as Toolki
Christian Meesters wrote:
Hi
How can I initialize a class like this from a file:
class Some:
def __init__(self,data,axis,**kwargs):
pass
'data' and 'axis' should be lists of floats. Meta data can be passed to
kwargs like 'name="name",date="2/3/05",...'.
Right now the return value of my
Brian van den Broek wrote:
Kent Johnson said unto the world upon 2005-03-17 20:44:
The multiple inheritance from MyNode and Toolkit.NodeX is a smell. I
guess you do this because you want to override methods of Toolkit.Node
as well as Toolkit.NodeX, or add methods to both MyNode1 and MyNode2?
I
Hi
How can I initialize a class like this from a file:
class Some:
def __init__(self,data,axis,**kwargs):
pass
'data' and 'axis' should be lists of floats. Meta data can be passed to
kwargs like 'name="name",date="2/3/05",...'.
Right now the return value of my function read
Gregor Lingl a écrit :
Hi!
Who knows a more concise or equally concise but more efficient
expression, which returns the same result as
[x for x in range(2,100) if not [y for y in range(2,x) if x%y==0]]
Gregor
P.S.: ... or a more beautiful one ;-)
___
Tuto
On Mar 18, 2005, at 02:15, Kent Johnson wrote:
Max Noel wrote:
#!/usr/bin/env python
import math
import timeit
def primeConcise(limit):
return [2] + [x for x in xrange(3, limit, 2) if not [y for y in
[2] + range(3,x,2) if x%y==0]]
def primeConciseOptimized(limit):
return [2] + [x for x in
14 matches
Mail list logo