On 18/07/2020 11:09, Steven D'Aprano wrote:
On Sat, Jul 18, 2020 at 10:58:17AM +0200, Federico Salerno wrote:
We don't, after all, confuse function calls for references to a function, or vice-versa.
Beginners do. Frequently. Sometimes it is quite a hurdle for them to learn to write `function()` instead of `function`.
And even experienced developers sometimes forget to put parentheses after file.close, or at least we used to before context managers.
(I know I did. I don't think I'm alone.)
I consider myself far from being an experienced developer, but I cannot in all honesty say I'm likely to forget parens after file.close any more than after any function call. Perhaps it comes down to being used to some other language I have never worked with.
I can see why beginners would find the distinction between func and func() to be challenging at first, but that is something that subsides relatively often. Most likely way before one needs to be aware of the intricacies of a complex feature such as pattern matching, considering Python, contrary to e.g. Rust or functional languages, is not built around that concept and has survived without it thus far. Pattern matching would be useful and nice, but not essential to the point that a beginner would have to learn it before getting a solid grasp on how functions are called or referenced.