Parentheses (as after "print")

Ben Finney ben+python at benfinney.id.au
Wed Sep 27 00:14:05 EDT 2017


ram at zedat.fu-berlin.de (Stefan Ram) writes:

>   Why do we newbies write »print 2«? Here's another hint.
>   This is an original transcript of what happened to me today:
[…]

>   What happened? I woke up today in parens mood. So I typed:
>
> import( operator )

So, are you making the case that people write the wrong syntax because
they wake up in the wrong mood?

Python doesn't much care about our mood :-) The syntax is what it is,
and the programmer has to deal with the syntax as it is.

>   Python told me that I should type:
>
> import operator
>
>   . Fine, Python conditioned me to omit the parens.

Hopefully Python is conditioning you that a function call requires
parens; the above statement does not have a function call.

What is being communicated to us with this example, do you think?

-- 
 \      “If you fell down yesterday, stand up today.” —_The Anatomy of |
  `\                                   Frustration_, H. G. Wells, 1936 |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list