Lies in education [was Re: The "loop and a half"]

Marko Rauhamaa marko at pacujo.net
Fri Oct 13 09:22:36 EDT 2017


Gregory Ewing <greg.ewing at canterbury.ac.nz>:

> Neil Cerutti wrote:
>> I can tell at a glance if a parameter is expected to be modifiable
>> just by looking at the function signature.
>
> The question is why doesn't anyone feel the need to be able to do that
> for Python functions? Whether a function modifies things passed to it
> is just as important to know in Python as it is in C.

I often ponder what information should be conveyed by the declaration.
For example, some methods are called with lock taken while others not.
Should that be indicated in the name of the function? Also ownership and
other contractual matters.

I occasionally fall into the temptation of coding such aspects in names,
but equally often the attempt backfires. Most you get is silly syntactic
clutter.

Let's just say that the problem remains unsolved, maybe unsolvable, and
any attempts at solving the problem seem to cause worse problems.

BTW, the original reason for C requiring declarations in the first place
wasn't readability. Rather, it was to make compilation possible in the
first place. It is interesting that C++ and Java have taken steps to
remove such information where the compiler can know or guess it from the
context.


Marko



More information about the Python-list mailing list