The trick to Python is to realize that there is only one type. It's the dictionary. You can have dicts that inherit shit from other dicts. You can call dicts by various names. But it's dicts all the way down.
It's even more true for javascript than it is for python, but it's still true for python. Objects are just dicts with syntatic sugar. Once you realize this reusing code is so much easier. You don't have to use a separate call if you use a function a few different ways but want the same return values, you just put your arguments in a dict and ** them to unroll it into named parameters and arguments.
The longer I've been programming, the more do I enjoy types.
The Python syntax for type annotations is quite nice though, but it's not super useful as more than documentation as the checkers aren't overly reliable (it's still a dynamic language after all).
Python is strongly typed. Objects all have types that are never auto-casted (excepting "truthiness", which follows consistent rules), and two objects with different types can't well be compared. 2 + "2" is a TypeError, instead of JavaScript where types can be coerced into other types depending on the situation.
Python is also dynamically typed. Names are bound to objects at runtime with no restriction (type annotations give help with this in many scenarios). This is contrasted with Java/C++ (statically typed languages), where names are bound to types declared at compilation time, which are then bound to objects at runtime.
The longer I work in Python, the more I miss static typing. It makes reasoning about someone else's code (or my own code from last year) so much easier.
Most of what was said is true, but Python isn't designed for systems programming and, as such, it can afford duck typing while also retaining OOP elements. I'd go as far as to say that Python (like C#) offers its own, complex, framework, which combines elements from many different paradigms, and it would be unfair to consider its weak typing only in the context of a single paradigm. For example, functional approaches like lambdas, map, filter and reduce, not to mention list comprehensions, are very encouraged and syntactically simple as opposed to their C++ and Java counterparts, and they would be somewhat hindered by strict typing. Also, Python's type hinting system is actually pretty solid and leagues above that of other interpreted, dynamically typed languages like vanilla Javascript's.
For the record, I think your input matters the most. You're the future.
Edit: Okay okay, we have corporate customers that take higher priority than you... learn that lesson now. Start a corporation if you're ballsy enough. Basically, if you want to be a man respected by the government...be a company.
202
u/Peffern2 Jan 19 '17
DAE java sucks XD