3 ms·
Python being intuition-centric is true in the sense that there are a limited number of orthodox, pythonic ways of accomplishing something, so if you're invested
by niftich 10y ago
Python being intuition-centric is true in the sense that there are a limited number of orthodox, pythonic ways of accomplishing something, so if you're invested in the Python philosophy, those solutions will come to you. The comparison to Java, albeit a bit surprising, comes from the notion that both of them ship with intentionally simple building blocks, which you can chain together in a limited, constrained set of ways.
This kind of programming leads to Java's verbosity, where to read a file, you have to obtain an InputStream, so you use a FileReader, but you probably want to wrap in inside of a BufferedInputStream to get buffering, which you probably want to surround in a try-catch-finally to clean up exceptional states, which you're going to want to call readLines on until you run out of lines, which you want to put into a data structure that implements the interface List<>. None of these building-blocks are complex on their own. Furthermore, Java is about enforcing language restrictions from the programmer -- you must deal with checked exceptions before you can proceed, you must not clash types, you must provide an implementation of this abstract method, you must not access this private variable.
Meanwhile Python encourages 'pythonic' constructs, which are idiomatic ways of accomplishing a certain task; these are not unlike what Java programmers would call 'design patterns'. But Python is more lax than Java, and has a notion of 'we're all adults here' [1] towards OO.
Perl takes 'we're all adults' to a new level, providing a LOT of specialized syntax and sophisticated heuristics to squeeze more expressive power from expressions.
[1] http://stackoverflow.com/questions/70528/why-are-pythons-private-methods-not-actually-private http://stackoverflow.com/questions/70528/why-are-pythons-pri...