I come from the C language, that is a compiled and strongly typed language. I learned many good tricks to write good code in C: choose a coding style, turn on as many warnings as possible, explicitly declare static variables and functions (when needed), explicitly declare const variables (if the piece of code will not change them), explicitly declare all the functions, and so on.

All the tricks have a common goal: to discover bugs as soon as possible, mostly during compilation process. Indeed I usually find some bugs during compilation (or static analysis). It seems to me very important.


Now I'm learning Python and it appears to me very simple, but at the same time highly dangerous. For example, I can write a function that accepts two arguments and call it with only one argument. I can execute the script without any problem and I will not notice the bug until I test exactly the erroneous line of code (the call with only one argument).

However, I think the language interpreter could emit the error before launching the script even without executing the wrong instruction, because it perfectly knows how many arguments the function wants and that one instruction calls it with a wrong number of arguments.

Are the things exactly how I understood, or do I miss something in Python?
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to