2013-10-19

Python uses Syntactic Sugar to enable some back-compatibility.

At BCDO,
https://bootcampdevops.com/
I learned that my big stumbling block to learning Python was my lack of understanding that numerous constructs exist merely to enable back-compatibility, forward changes, etc.

For example, the 'new' Python classes are identified by extra verbiage. Even though every class in Python inherits from Object, one must specifically specify that for classes that have no other parent.

Similarly, "self" is used all over the place, ie as the first argument of many methods, in order to specifically designate methods that are part of a class. Formally, a procedure in a class is a method, and a procedure outside a class and merely in the file module itself is called a function. So each and every method must have 'self' as its first parameter. It's easy to remember, since of course those same methods will be called with self.xx. Note that the caller does not repeat the word 'self' in the argument list it passes.

Finally I feel much more intelligent reading the code!

No comments:

Post a Comment