Re: which is more pythonic/faster append or +=[]

2007-05-14 Thread 7stud
On May 10, 2:39 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > 7studwrote: > >> Is there any documentation for the syntax you used with timeit? > > > This is the syntax the docs describe: > [snip > > python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] > [snip] > > Then in the exam

Re: which is more pythonic/faster append or +=[]

2007-05-10 Thread Alex Martelli
Peter Otten <[EMAIL PROTECTED]> wrote: > Note the -s before the initialization statement that Alex meant to add but > didn't. If that is missing Yep, sorry for erroneously skipping the -s! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: which is more pythonic/faster append or +=[]

2007-05-10 Thread Steven Bethard
7stud wrote: >> Is there any documentation for the syntax you used with timeit? > > This is the syntax the docs describe: [snip > python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] [snip] > Then in the examples in section 10.10.2 [snip] > timeit.py 'try:' ' str.__nonzero__' 'exc

Re: which is more pythonic/faster append or +=[]

2007-05-10 Thread 7stud
> Is there any documentation for the syntax you used with timeit? This is the syntax the docs describe: --- Python Reference Library 10.10.1: When called as a program from the command line, the following form is used: python timeit.py [-n N] [-r N] [-s S] [-t] [-c] [-h] [statement ...] --- Then

Re: which is more pythonic/faster append or +=[]

2007-05-10 Thread Peter Otten
Stargaming wrote: > Alex Martelli schrieb: >> 7stud <[EMAIL PROTECTED]> wrote: >>... >> .append - easy to measure, too: brain:~ alex$ python -mtimeit 'L=range(3); n=23' 'x=L[:]; x.append(n)' 100 loops, best of 3: 1.31 usec per loop brain:~ alex$ python -mtimeit '

Re: which is more pythonic/faster append or +=[]

2007-05-10 Thread Stargaming
Alex Martelli schrieb: > 7stud <[EMAIL PROTECTED]> wrote: >... > >>>.append - easy to measure, too: >>> >>>brain:~ alex$ python -mtimeit 'L=range(3); n=23' 'x=L[:]; x.append(n)' >>>100 loops, best of 3: 1.31 usec per loop >>> >>>brain:~ alex$ python -mtimeit 'L=range(3); n=23' 'x=L[:]; x+=

Re: which is more pythonic/faster append or +=[]

2007-05-09 Thread Alex Martelli
7stud <[EMAIL PROTECTED]> wrote: ... > > .append - easy to measure, too: > > > > brain:~ alex$ python -mtimeit 'L=range(3); n=23' 'x=L[:]; x.append(n)' > > 100 loops, best of 3: 1.31 usec per loop > > > > brain:~ alex$ python -mtimeit 'L=range(3); n=23' 'x=L[:]; x+=[n]' > > 100 loops, be

Re: which is more pythonic/faster append or +=[]

2007-05-09 Thread kyosohma
On May 9, 11:08 am, 7stud <[EMAIL PROTECTED]> wrote: > On May 8, 11:05 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > > > > > alf <[EMAIL PROTECTED]> wrote: > > > two ways of achieving the same effect > > > > l+=[n] > > > > or > > > > l.append(n) > > > > so which is more pythonic/faster? > > > .app

Re: which is more pythonic/faster append or +=[]

2007-05-09 Thread 7stud
On May 8, 11:05 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > alf <[EMAIL PROTECTED]> wrote: > > two ways of achieving the same effect > > > l+=[n] > > > or > > > l.append(n) > > > so which is more pythonic/faster? > > .append - easy to measure, too: > > brain:~ alex$ python -mtimeit 'L=range(3);

Re: which is more pythonic/faster append or +=[]

2007-05-09 Thread 7stud
On May 8, 11:05 pm, [EMAIL PROTECTED] (Alex Martelli) wrote: > alf <[EMAIL PROTECTED]> wrote: > > two ways of achieving the same effect > > > l+=[n] > > > or > > > l.append(n) > > > so which is more pythonic/faster? > > .append - easy to measure, too: > > brain:~ alex$ python -mtimeit 'L=range(3);

Re: which is more pythonic/faster append or +=[]

2007-05-08 Thread Alex Martelli
alf <[EMAIL PROTECTED]> wrote: > two ways of achieving the same effect > > > l+=[n] > > or > > l.append(n) > > > so which is more pythonic/faster? .append - easy to measure, too: brain:~ alex$ python -mtimeit 'L=range(3); n=23' 'x=L[:]; x.append(n)' 100 loops, best of 3: 1.31 usec per

which is more pythonic/faster append or +=[]

2007-05-08 Thread alf
two ways of achieving the same effect l+=[n] or l.append(n) so which is more pythonic/faster? -- alfz1 -- http://mail.python.org/mailman/listinfo/python-list