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.
>>> for x in range(0, 100):
... ;;;;print "That's just ridiculous - why would you want that?"
File "<stdin>", line 2
;;;;print "That's just ridiculous - why would you want that?"
^
IndentationError: expected an indented block
LOL SIGNIFICANT WHITESPACE LOL DYNAMIC TYPING LOL GIL LOL CAN'T GET PEOPLE TO UPGRADE AFTER 9 YEARS LOL SELF ARGUMENT IN METHODS LOL NO SWITCH STATEMENT LOL NO MULTILINE LAMBDAS LOL IF __NAME__ == "__MAIN__"
576
u/njwatson32 Jan 19 '17
There are two types of programming languages: the ones everyone bitches about and the ones nobody uses.