Skip to content

Comment on Pythonpy – Command-line Kung Fu with Python

Comments

Neat. I'm curious why the quotes around the commands are necessary. Why "py '3 * 1.5'" instead of just "py 3 * 1.5"?

It's required to prevent the shell from interpreting and expanding special characters. e.g. in the example you provide, without quotes * will be expanded to a list of files in the current directory.

Maybe the program only parses its first argument. The asterisk would need to be escaped, in any case, to prevent the shell from expanding it.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.