Steven Bethard [EMAIL PROTECTED] writes:
Some timings to verify this:
$ python -m timeit -s def square(x): return x*x map(square, range(1000))
1000 loops, best of 3: 693 usec per loop
$ python -m timeit -s [x*x for x in range(1000)]
1000 loops, best of 3: 0.0505 usec per loop
Maybe you
David M. Cooke wrote:
Steven Bethard [EMAIL PROTECTED] writes:
Some timings to verify this:
$ python -m timeit -s def square(x): return x*x map(square, range(1000))
1000 loops, best of 3: 693 usec per loop
$ python -m timeit -s [x*x for x in range(1000)]
1000 loops, best of 3: 0.0505 usec per
Andrey Tatarinov [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
How does GvR suggestions on removing map(), reduce(), filter()
While GvR *might* prefer removing them completely on any given day, I think
moving them to a functional module, as others have suggested and requested,
is
Terry Reedy wrote:
Andrey Tatarinov [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
How does GvR suggestions on removing map(), reduce(), filter()
While GvR *might* prefer removing them completely on any given day, I think
moving them to a functional module, as others have suggested
Hi.
How does GvR suggestions on removing map(), reduce(), filter() correlate
with the following that he wrote himself (afaik):
http://www.python.org/doc/essays/list2str.html
?
--
http://mail.python.org/mailman/listinfo/python-list
Andrey Tatarinov [EMAIL PROTECTED] writes:
How does GvR suggestions on removing map(), reduce(), filter()
correlate with the following that he wrote himself (afaik):
http://www.python.org/doc/essays/list2str.html
I think that article was written before list comprehensions were added
to
Paul Rubin wrote:
How does GvR suggestions on removing map(), reduce(), filter()
correlate with the following that he wrote himself (afaik):
http://www.python.org/doc/essays/list2str.html
I think that article was written before list comprehensions were added
to Python.
anyway list comprehensions
Andrey Tatarinov [EMAIL PROTECTED] writes:
anyway list comprehensions are just syntaxic sugar for
for var in list:
smth = ...
res.append(smth)
(is that correct?)
I would expect lc's to work more like map does.
--
http://mail.python.org/mailman/listinfo/python-list
Andrey Tatarinov wrote:
anyway list comprehensions are just syntaxic sugar for
for var in list:
smth = ...
res.append(smth)
(is that correct?)
so there will be no speed gain, while map etc. are C-implemented
It depends.
Try
def square(x):
return x*x
map(square, range(1000))
On Sun, 9 Jan 2005, Paul Rubin wrote:
Andrey Tatarinov [EMAIL PROTECTED] writes:
I hope there will be
from __past__ import functional_paradigma
in Python 3 ;-)
And, also, what is the best way to replace reduce() ?
Sincerely yours, Roman Suzi
--
[EMAIL PROTECTED] =\= My AI powered by
Andrey Tatarinov wrote:
Hi.
How does GvR suggestions on removing map(), reduce(), filter() correlate
with the following that he wrote himself (afaik):
http://www.python.org/doc/essays/list2str.html
?
It promotes the sensible realization that when optimization is the goal
code may well tend to
Steve Holden wrote:
Andrey Tatarinov wrote:
Hi.
How does GvR suggestions on removing map(), reduce(), filter()
correlate with the following that he wrote himself (afaik):
http://www.python.org/doc/essays/list2str.html
And note that the summary in the conclusiogn BEGINS with Rule number
one:
Andrey Tatarinov wrote:
Steve Holden wrote:
Andrey Tatarinov wrote:
Hi.
How does GvR suggestions on removing map(), reduce(), filter()
correlate with the following that he wrote himself (afaik):
http://www.python.org/doc/essays/list2str.html
And note that the summary in the conclusiogn BEGINS
Robert Kern wrote:
Andrey Tatarinov wrote:
anyway list comprehensions are just syntaxic sugar for
for var in list:
smth = ...
res.append(smth)
(is that correct?)
so there will be no speed gain, while map etc. are C-implemented
It depends.
Try
def square(x):
return x*x
Andrey Tatarinov [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi.
How does GvR suggestions on removing map(), reduce(), filter() correlate
with the following that he wrote himself (afaik):
http://www.python.org/doc/essays/list2str.html
This is fairly old. Note that the fastest
Steven Bethard wrote:
Note that list comprehensions are also C-implemented, AFAIK.
Rather strange meaning attached to C-implemented. The implementation
generates the code that would have been generated had you written out
the loop yourself, with a speed boost (compared with the fastest DIY
Steve Holden wrote:
def square(x):
return x*x
map(square, range(1000))
versus
[x*x for x in range(1000)]
Hint: function calls are expensive.
$ python -m timeit -s def square(x): return x*x map(square,
range(1000))
1000 loops, best of 3: 693 usec per loop
$ python -m timeit
[EMAIL PROTECTED] wrote:
Steve Bethard wrote:
Robert Kern wrote:
def square(x):
return x*x
map(square, range(1000))
versus
[x*x for x in range(1000)]
Hint: function calls are expensive.
$ python -m timeit -s def square(x): return x*x map(square, range(1000))
1000 loops, best of 3: 693
18 matches
Mail list logo