This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: timeit needs "official" '--' flag
Type: Stage:
Components: Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, georg.brandl
Priority: normal Keywords:

Created on 2009-01-02 16:41 by skip.montanaro, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg78838 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2009-01-02 16:41
Consider this timeit run:

    % python -m timeit '-1.0e-3 < -0.0001 < 1.0e-3'
    option -1 not recognized
    use -h/--help for command line help

As it turns out this works:

    % python -m timeit -- '-1.0e-3 < -0.0001 < 1.0e-3'
    10000000 loops, best of 3: 0.192 usec per loop

but the output using the -h flag doesn't report it as a possibility.  It
probably should.
msg106512 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-05-26 07:47
This "--" trick is implemented by the getopt module.
OTOH on my system, 'grep' also recognizes this, and I could not find any documentation about it, neither with "grep --help" nor "man grep".
msg112292 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-08-01 08:53
Usually I would say that this is common UNIX knowledge, except that timeit is also used in Windows environments.  Also, the timeit help is already quite thorough, so it can't hurt to mention "--".  Done in r83396.
Date User Action Args
2022-04-11 14:56:43adminsetgithub: 49060
2010-08-01 08:53:15georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg112292

resolution: fixed
2010-05-26 07:47:34amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg106512
2010-05-20 20:34:29skip.montanarosetnosy: - skip.montanaro
-> (no value)
2009-01-02 16:41:27skip.montanarocreate