Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84615
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.005 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'python3': 0.07; '2000,': 0.09; 'objects,': 0.09; 'subject:None': 0.09; 'subject:Why': 0.09; 'jan': 0.12; 'mostly': 0.14; '10000000': 0.16; '100000000': 0.16; '323': 0.16; 'subject: \n ': 0.16; 'subject:argparse': 0.16; 'tuple': 0.16; 'wrote:': 0.18; 'mon,': 0.24; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'away.': 0.31; 'constant': 0.31; 'object.': 0.31; 'though.': 0.31; 'time:': 0.31; 'probably': 0.32; 'received:google.com': 0.35; 'subject:?': 0.36; 'being': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'ian': 0.60; '10000': 0.68; '26,': 0.68; '2015': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=VUgfj/j+LWC1JuAPQNRDQWPJ1PIzU9wAZxbC7R8T7Ro=; b=YO3RUR8Np5pjDA+nAfT3vi143rtM3y6+FXlXbjtG4Th352jVR1KBMYLbDavAh0hkVs 3Qwpfkisx8TazLkItXS22BZkSn98TqWhNvB0RE4/ub2sN3QtbkIxaYhipoQOE8yMQEaS qU/Ol33EOKx/XhxFwSqvuWMD6qJPBmJ4ZHW1C8zUfmFbNA/H5vbWVDsFBtZxg8ESUxqG iIYdnXA/xGLKBzuDDKXDIwI9yMR0YoCAXdKeK7sJcWayMjFUJg38GjVaW++8teTZyLGO ZMUcn1dMN6j6OAwFTgWRhFvw/6tKvAmroCcmJ7O2Yn4aH9dbQITWqPHoDQsF0uF0aZPO zJPw== |
| X-Received | by 10.66.120.109 with SMTP id lb13mr37190423pab.66.1422296834553; Mon, 26 Jan 2015 10:27:14 -0800 (PST) |
| MIME-Version | 1.0 |
| In-Reply-To | <CALwzid=rzENxp3GHQbcu5WrnFesEJQFD==DDfrDC=EcX4=_WjQ@mail.gmail.com> |
| References | <l265obxc6d.ln2@news.ducksburg.com> <mailman.17529.1420816664.18130.python-list@python.org> <8tshpbxjvv.ln2@news.ducksburg.com> <mailman.18148.1422281105.18130.python-list@python.org> <ta4ipbx9j3.ln2@news.ducksburg.com> <mailman.18151.1422288861.18130.python-list@python.org> <qotioft4iao.fsf@ruuvi.it.helsinki.fi> <ma5ssj$ars$1@ger.gmane.org> <CALwzid=rzENxp3GHQbcu5WrnFesEJQFD==DDfrDC=EcX4=_WjQ@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Mon, 26 Jan 2015 11:26:33 -0700 |
| Subject | Re: Why does argparse return None instead of [] if an append action isn't used? |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18156.1422296837.18130.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1422296837 news.xs4all.nl 2829 [2001:888:2000:d::a6]:46368 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:84615 |
Show key headers only | View raw
On Mon, Jan 26, 2015 at 11:23 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote: > $ python3 -m timeit 't = (1000, 2000, 3000)' > 100000000 loops, best of 3: 0.0147 usec per loop > $ python3 -m timeit 't = [1000, 2000, 3000]' > 10000000 loops, best of 3: 0.0678 usec per loop > $ python3 -m timeit 't = tuple(range(10000))' > 10000 loops, best of 3: 183 usec per loop > $ python3 -m timeit 't = list(range(10000))' > 10000 loops, best of 3: 174 usec per loop > $ python3 -m timeit 't = tuple(range(10000000))' > 10 loops, best of 3: 323 msec per loop > $ python3 -m timeit 't = list(range(10000000))' > 10 loops, best of 3: 306 msec per loop > > This is probably a result of the use of freelists to avoid > reallocating the tuple objects, though. I don't see any substantial > difference in access time: Whoops. Actually it's a result of the 3-element tuple being a constant in the code object. If we use the constructor, the difference mostly goes away. $ python3 -m timeit 't = tuple(range(1000, 4000, 1000))' 1000000 loops, best of 3: 0.559 usec per loop $ python3 -m timeit 't = list(range(1000, 4000, 1000))' 1000000 loops, best of 3: 0.585 usec per loop
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why does argparse return None instead of [] if an append action isn't used? Adam Funk <a24061@ducksburg.com> - 2015-01-09 14:44 +0000
Re: Why does argparse return None instead of [] if an append action isn't used? Skip Montanaro <skip.montanaro@gmail.com> - 2015-01-09 08:57 -0600
Re: Why does argparse return None instead of [] if an append action isn't used? Adam Funk <a24061@ducksburg.com> - 2015-01-09 15:25 +0000
Re: Why does argparse return None instead of [] if an append action isn't used? Ned Batchelder <ned@nedbatchelder.com> - 2015-01-09 10:12 -0500
Re: Why does argparse return None instead of [] if an append action isn't used? Adam Funk <a24061@ducksburg.com> - 2015-01-26 13:43 +0000
Re: Why does argparse return None instead of [] if an append action isn't used? Peter Otten <__peter__@web.de> - 2015-01-26 15:04 +0100
Re: Why does argparse return None instead of [] if an append action isn't used? Adam Funk <a24061@ducksburg.com> - 2015-01-26 15:50 +0000
Re: Why does argparse return None instead of [] if an append action isn't used? Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-26 09:13 -0700
Re: Why does argparse return None instead of [] if an append action isn't used? Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-01-26 18:29 +0200
Re: Why does argparse return None instead of [] if an append action isn't used? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-01-26 17:18 +0000
Re: Why does argparse return None instead of [] if an append action isn't used? Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-26 11:23 -0700
Re: Why does argparse return None instead of [] if an append action isn't used? Ian Kelly <ian.g.kelly@gmail.com> - 2015-01-26 11:26 -0700
Re: Why does argparse return None instead of [] if an append action isn't used? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2015-01-09 16:50 +0100
Re: Why does argparse return None instead of [] if an append action isn't used? Adam Funk <a24061@ducksburg.com> - 2015-01-26 13:43 +0000
csiph-web