[New-bugs-announce] [issue40568] Modify -c command-line option to accept multiple inputs

Raymond Hettinger report at bugs.python.org
Fri May 8 15:08:57 EDT 2020


New submission from Raymond Hettinger <raymond.hettinger at gmail.com>:

It would be nice to write this:

    $ python -c 'from math import *' 'print(e**(1j * pi))'

Instead of this:

    $ python -c 'from math import *; print(e**(1j * pi))'
    (-1+1.22464679915e-16j)

That would also make it possible input an indented block:

    $ python -c 'with open("somefile.txt") as f:'  '  s = f.read()' '  print(len(s))'

This feature would be especially useful in bash scripts.

FWIW, the timeit module already supports this convenience:

    $ python -m timeit -s 'from math import sqrt' -s 'x = 5' 'y = x ** 2' 'z = sqrt(y)'
    10000000 loops, best of 3: 0.0819 usec per loop

----------
components: Interpreter Core
messages: 368454
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Modify -c command-line option to accept multiple inputs
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40568>
_______________________________________


More information about the New-bugs-announce mailing list