3 ms·
This is interesting, I'd never be able to write something like: print is the name of a Python command, which sends messages to output. The parentheses () after
by unwind 11y ago
This is interesting, I'd never be able to write something like:
print is the name of a Python command, which sends messages to output. The parentheses () after the print command are used to contain what you want to print.
I really dislike the idea that programming languages have "commands", so I would have called it a function since that's the actual term used. And that of course would lead to explaining the parentheses as part of calling a function, by enclosing the parameters.
I admit I didn't read far in this tutorial, so perhaps more correct/typical terminology is introduced later.
- jonsen 11y ago"Specifically, the term command is used in imperative computer languages. These languages are called this, because statements in these languages are usually written in a manner similar to the imperative mood used in many natural languages. If one views a statement in an imperative language as being like a sentence in a natural language, then a command is generally like a verb in such a language." https://en.wikipedia.org/wiki/Command_(computing) https://en.wikipedia.org/wiki/Command_(computing)
- dragonwriter 11y ago> I really dislike the idea that programming languages have "commands" I can see a perspective in which it makes sense to call imperative subroutines (in Python terms, functions that have side effects and follow the Python idiom for principally-effectful functions of returning None regardless of their inputs) "commands". But I probably wouldn't do it in a Python-focussed tutorial intended for new programmers, because it conflicts with what the language itself calls them and creates unnecessary friction.
- nickysielicki 11y agoI think it's fair to say you're commanding the interpreter to run some function. Particularly when it comes to builtins.
- mroll 11y ago> I really dislike the idea that programming languages have "commands" I guess you would really hate tcl, then. Everything is a command.