Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10103

Re: Question about timeit

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <t@jollybox.de>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'args': 0.05; 'python?': 0.05; 'command.': 0.09; 'none:': 0.09; 'skip:[ 20': 0.12; 'wrote:': 0.15; 'literals': 0.16; 'received:192.168.1.40': 0.16; 'argument': 0.16; 'command': 0.19; 'seems': 0.20; 'loop': 0.22; 'header:In-Reply-To:1': 0.22; 'subject:Question': 0.25; 'pass': 0.28; 'modifying': 0.30; 'does': 0.32; 'skip:" 20': 0.33; 'to:addr :python-list': 0.34; 'header:User-Agent:1': 0.34; 'received:192': 0.38; 'subject:: ': 0.38; 'received:192.168.1': 0.39; 'to:addr:python.org': 0.39; 'eliminate': 0.63; 'received:62': 0.67; '(single': 0.84; '100000': 0.84; 'from:addr:t': 0.84; 'spaces.': 0.84
Date Fri, 22 Jul 2011 14:43:22 +0200
From Thomas Jollans <t@jollybox.de>
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) Gecko/20110626 Iceowl/1.0b2 Icedove/3.1.11
MIME-Version 1.0
To python-list@python.org
Subject Re: Question about timeit
References <j0b41p$krj$1@dough.gmane.org> <mailman.1350.1311316646.1164.python-list@python.org> <83238f45-e72d-4ea9-9b4a-a42d26cd7282@x7g2000vbk.googlegroups.com> <j0bb5t$11c$1@r03.glglgl.eu> <mailman.1353.1311323659.1164.python-list@python.org> <ed943cd7-1986-4e09-a062-a084ef623c73@fq4g2000vbb.googlegroups.com>
In-Reply-To <ed943cd7-1986-4e09-a062-a084ef623c73@fq4g2000vbb.googlegroups.com>
X-Enigmail-Version 1.1.2
OpenPGP id=5C8691ED
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1364.1311338605.1164.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1311338605 news.xs4all.nl 23931 [2001:888:2000:d::a6]:44397
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:10103

Show key headers only | View raw


On 22/07/11 14:30, Frank Millman wrote:
> This is what I get after modifying timeit.py as follows -
> 
>     if args is None:
>         args = sys.argv[1:]
> +       print(args)
> 
> C:\>python -m timeit int(float('165.0'))
> ["int(float('165.0'))"]
> 100000 loops, best of 3: 3.43 usec per loop
> 
> C:\>python -m timeit int(float("165.0"))
> ['int(float(165.0))']
> 1000000 loops, best of 3: 1.97 usec per loop
> 
> C:\>python -m timeit "int(float('165.0'))"
> ["int(float('165.0'))"]
> 100000 loops, best of 3: 3.45 usec per loop
> 
> It seems that the lesson is -
> 
> 1. Use double-quotes around the command itself - may not be necessary
> if the command does not contain spaces.
> 2. Use single-quotes for any literals in the command.

What about 'int(float("165.0"))' (single quotes around the argument)?
Does that pass the single quotes around the argument to Python? Or does
it eliminate all quotes?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Question about timeit Stefan Behnel <stefan_ml@behnel.de> - 2011-07-22 08:37 +0200
  Re: Question about timeit Frank Millman <frank@chagford.com> - 2011-07-21 23:59 -0700
    Re: Question about timeit Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2011-07-22 10:08 +0200
      Re: Question about timeit Stefan Behnel <stefan_ml@behnel.de> - 2011-07-22 10:34 +0200
        Re: Question about timeit Frank Millman <frank@chagford.com> - 2011-07-22 05:30 -0700
          Re: Question about timeit Thomas Jollans <t@jollybox.de> - 2011-07-22 14:43 +0200
            Re: Question about timeit Frank Millman <frank@chagford.com> - 2011-07-22 23:30 -0700

csiph-web