An implicit print() would be convenient, too.<br><br>On Friday, January 5, 2018, Wes Turner <<a href="mailto:wes.turner@gmail.com">wes.turner@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Could it just check if -c and -m are both set?<br></div><div>That way there'd be no need for -p or -M.</div><div><br></div><div>(I have an -m <module> switch in pyline which does exactly this. It makes copying and pasting less convenient; but does save having to type 'import module;’ for one liners)<br><br>On Friday, January 5, 2018, Steve Barnes <<a href="mailto:gadgetsteve@live.co.uk" target="_blank">gadgetsteve@live.co.uk</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Currently invoking `python -c "some;separated;set of commands;"` will,<br>
if you need to use any library functions, require one or more import<br>
somelib; sections in the execution string. This results in rather<br>
complex "one liners".<br>
<br>
On the other hand `python -m somelib` will load somelib and attempt to<br>
execute its `__main__()` or give an error if there isn't one.<br>
<br>
What I would like to suggest is a mechanism to pre-load libraries before<br>
evaluating the -c option as this would allow the use of code from<br>
libraries that don't have a `__main__` function, or those that do but it<br>
doesn't do what you want.<br>
<br>
Since -m for module is already taken I would suggest one of:<br>
    -p for pre-load module<br>
    -M for load module without attempting to execute `module.__main__()`<br>
and without defining "__main__" in the load context or<br>
    -l for library<br>
with the last two having the advantage of appearing next to -m in the<br>
--help output.<br>
<br>
This would change, (for a trivial example):<br>
    `python -c"import numpy;print(numpy.pi);"`<br>
to:<br>
    `python -M numpy -c"print(numpy.pi);"`<br>
<br>
<br>
--<br>
Steve (Gadget) Barnes<br>
Any opinions in this message are my personal opinions and do not reflect<br>
those of my employer.<br>
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
</blockquote></div>
</blockquote>