3 ms·
The code samples are striking: they demonstrate how verbose Java can be, compared to Python!
by anondon 10y ago
The code samples are striking: they demonstrate how verbose Java can be, compared to Python!
- TurboHaskal 10y agoI'll trade verbosity for braces and no significant whitespace any day of the week.
- irb 10y agoSwitched from Java to Python as my main moneymaker several years go and I still don't understand why some people have such a big problem with significant whitespace. You format your code anyway, right? So what's the difference if it actually means something?
- TurboHaskal 10y agoThese people either work with very large codebases or have enough experience to understand that the average developer is careless enough to risk safety just for a little bit of convenience. I'm personally keen on using % on vi or clicking on the braces for selecting scope in Eclipse and ACME. I also find them aesthetically appealing much like Lisp parenthesis.
- lucb1e 10y agoIf you have enough blank lines, { or } work as well in vim. At least that's what I use. Thinking about it, I only use % for parenthesis I think.
- ldiracdelta 10y agoI've seen a parallel in braced languages where the code spacing alignment was out of whack with the actual blocks as denoted with bracing and then people thought they were adding code to one block, but it was actually a parent block. People seem to inherently use white space to determine block scope.
- guest2143 10y agofrom __future__ import braces
- berntb 10y agoUse another scripting language if you are too allergic to code structure through white space (see -- narcissism of small differences, they are more similar than some people want to admit :-) ). The indentation works, more or less, but imho layout should be in a coding standard document not in the language specification. The problems I've had with Python's significant whitespace are maimed lambda functionality and for one liners (limits to if/else/loops/etc without braces). (And I believe that import braces comment is a bit of a joke, it gives an error message "not a chance" iirc. :-) )
- lucb1e 10y agoMy first thought when scrolling through it. This is a great example of what makes Python such a nice language.
- lmm 10y agoIt's worth being clear that statically typed languages don't have to be this verbose, this is a Java peculiarity. In Scala you write code that looks very much like Python.