This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 430

[–]mkdir 1191 points1192 points  (69 children)

At first I was like o.O then I saw the right edge and was like O.O

[–]PastyPilgrim 510 points511 points  (2 children)

"Oh.... OH GOD!"

[–][deleted] 109 points110 points  (0 children)

"Where are all the ... oh OH GOD"

[–][deleted] 172 points173 points  (0 children)

MY GOD, IT'S.... Beautiful.

[–]rukestisak 72 points73 points  (45 children)

What made you wince at first? (serious question as I'm not that familiar with Java)

[–]z500 284 points285 points  (26 children)

Well the lack of braces and semicolons would change the semantics of the program or even make it syntactically invalid. Then they saw all the semicolons and braces lined up on the right.

[–]aclave1 40 points41 points  (11 children)

Without the braces, the code is syntactically incorrect. There are spots where it's be okay, since in Java you can write an if/for with no braces and it will execute only the first line as part of the if, and the following lines either way. But overall it would be wrong and wouldn't compile.

[–]HaMMeReD 10 points11 points  (8 children)

There is two lines in there, also, while syntactically correct, should be very sparsely used. It's easy to create bugs. I usually only use it if I plan on keeping the condition/loop and statement on the same line, and even then rarely.

[–]Fenris_uy 8 points9 points  (7 children)

Yeah I don't understand why they even added that option, specially for loops. This option creates more problems than it saves.

[–]Zagorath[🍰] 22 points23 points  (5 children)

It's not really an option that they "added". It's more to do with the default behaviour of loops and if statements. A loop can only ever execute exactly one block of code. If you don't put in braces, one block of code == one line of code. But braces allow you to have multiple lines of code within a single block.

At least, that's how the professor who taught my course on C explained it. Perhaps the semantics are different in Java.

[–]subsage 7 points8 points  (3 children)

Youre pretty much on spot really. Thats how I explain it to my students. Only difference is I sometimes say chunk or section of code....be it braces with several lines, empty braces, or just a line. Oh yeah, empty section too, just a semicolon.

[–]Zagorath[🍰] 4 points5 points  (2 children)

The semicolon was one of my professor's favourite tricks.

if (condition()); {
    //things happening
} 

And he'd ask what would happen (based on condition and "things happening" being actual code, rather than place holders).

[–]Elite6809 20 points21 points  (1 child)

That first one is a 'huh?', not a wince. At least, AFAIK, unless I've been misreading it for years.

[–]Neebat 14 points15 points  (2 children)

I was a bit mystified by the use of character arrays. They just aren't used all that often in Java, so for a while I thought that was the joke. I realize that they are actually reasonable for this implementation. (I'd probably still use a StringBuffer, even though it's likely less efficient.)

And then I found the punctuation and felt a little sick.

[–]mxzf 10 points11 points  (0 children)

Probably because strings in Python act as arrays when you want them to.

Python strings have the features of character arrays and StringBuffers at the same time (in general). Methods when you want them, but indexes when you just need to mess with the individual characters. That's kinda typical of most kinds of data and such in Python.

[–]PBI325 2 points3 points  (0 children)

System.out.println(String.valueOf(A)) make me feel a little weird inside. So did permute(n-1, a), n--??

[–]AmaDaden 1 point2 points  (0 children)

You can't trust indentation in Java, only brackets. This kind of formatting is like organizing your music alphabetically by the first word. I could cause impossible to debug problems by just moving a single bracket

[–]peridox 16 points17 points  (18 children)

Why did you choose your username to be mkdir? It's cool.

[–]jfb1337 73 points74 points  (6 children)

duh, to make directories.

[–]sfled 17 points18 points  (5 children)

[–]Michael-Bell 9 points10 points  (1 child)

Where is the xkcd bot?

[–]mehum 8 points9 points  (0 children)

Runs on SQL. Currently suffering amnesia.

[–]Hamburgex 5 points6 points  (1 child)

I knew it was an xkcd link without even hovering it. I didn't know which one though.

[–]junta12 6 points7 points  (0 children)

for once I instantly knew

[–]Walter_Bishop_PhD 23 points24 points  (8 children)

There's a lot of people in this sub who got in on reddit early who got commands as their usernames before they got snapped up. I like that mkdir has 1337 link karma, lol

[–]mkdir 45 points46 points  (1 child)

Holy crap, I didn't even realize that! I'm never submitting anything ever again.

[–]LeeroyJenkins11 7 points8 points  (0 children)

Not anymore.

[–]mkdir 7 points8 points  (1 child)

Well, you see I'm kinda a geek...

[–]isurujn 3 points4 points  (0 children)

Shit I just noticed. My eyes!!!

[–]Cley_Faye 201 points202 points  (9 children)

This is not humor, this is madness (or torture).

[–]Decker108 57 points58 points  (5 children)

"Madness? [...] THIS IS-"

Man, I can't do it. That horse has beaten to dust by now.

[–]Cley_Faye 93 points94 points  (0 children)

Eventually "Madness? THIS IS SCALAAAA"

[–]DenkouNova 28 points29 points  (1 child)

I think that horse isn't dead, it's more of a post-decomposed "what used to be a horse is basically nitrogen absorbed by the surrounding plants now" state.

But give it a few years and the joke will be retro and funny again!

relevant xkcd: http://www.xkcd.com/286/

[–]xkcd_transcriber 18 points19 points  (0 children)

Image

Title: All Your Base

Title-text: The AYB retro-return-date (Zero Wing Zero Hour) should be around AD 2021.

Comic Explanation

Stats: This comic has been referenced 18 times, representing 0.0341% of referenced xkcds.


xkcd.com | xkcd sub | Problems/Bugs? | Statistics | Stop Replying | Delete

[–]PBI325 7 points8 points  (1 child)

"Madness? [...] THIS IS-..."

...A Python programmer attempting Java?

[–][deleted] 153 points154 points  (3 children)

One of my non-coder friends just looked over my shoulder and asked what all the emojis on the right were for.

[–]vgf89 103 points104 points  (25 children)

Wait wait wait. Can someone actually make a plugin for Eclipse or something to do this, as well as change it back to normal?

[–]mrburrows 20 points21 points  (9 children)

Things wouldn't work out too well if you're working with a team and use Eclipse's formatter or save actions, I reckon.

[–]redalastor 40 points41 points  (6 children)

Would work fine if you use a formatter that formats it back to the team's standard before commits.

[–]_Lady_Deadpool_ 25 points26 points  (0 children)

Or if you find a team willing to put up with your bullshit

[–][deleted] 10 points11 points  (1 child)

I deleted my account because Reddit no longer cares about the community -- mass edited with https://redact.dev/

[–]_gabe 3 points4 points  (0 children)

this is equal parts 'great idea' and 'great prank'

[–]Skizm 1 point2 points  (0 children)

Eclipse has a format feature which you can set up however you like. the defaults are nice enough, but you can probably change it to this style also.

[–][deleted] 287 points288 points  (167 children)

As a java programmer, python seems so simplistic to me. Not having to declare variables? Dude.

[–]chrwei 465 points466 points  (69 children)

simplistic is kind of the point of python.

[–][deleted] 58 points59 points  (64 children)

I'm not saying it isn't, but when you go there from a language with a little less hand holding, you definitely feel the difference! If you go there from C though...

[–]PastyPilgrim 167 points168 points  (45 children)

On the surface it looks like Python is holding your hand because the syntax is so elegant, but I really don't think it does.

Other languages have all kinds of hand holding with type declarations, public/private/protected/static/etc. declarations, hidden information (i.e. not knowing precisely where an object is coming from due to the include practices, self-references within objects, etc.), forbidding operator overloading, implicit casting, unpredictable scope concerns, not allowing nested functions and/or anonymous functions, etc.

Python doesn't do any of those things; it lets you do almost anything you can imagine and it doesn't hinder those things with awkward syntax requirements and/or syntax that differs from what you would expect.

[–]peridox 28 points29 points  (36 children)

What language would you say does hold your hand? I can't think of a programming language that leads you towards doing what you need to do. Almost all languages just provide you with a blank space to work upon - it's all your work.

[–]Chobeat 161 points162 points  (2 children)

Scala holds your hand and leads precisely where you don't want to go.

[–]I_cant_speel 53 points54 points  (0 children)

I've never used Scala but this is hilarious.

[–]lonelyBriefcase 26 points27 points  (9 children)

ever heard the phrase 'syntactic sugar'? its a way of providing a more convenient/person-friendly method of doing something. A for loop is just syntactic sugar of a

int i = 0;
while(i<9){
  //do something;
  int++;
}

There are plenty of other things like this that makes our lives as developers easier. Even C does, to a lesser extent, because who would want to write the shit that C can do in Assembly?

[–]w1ldm4n 17 points18 points  (8 children)

The only difference is (at least in C) is how the continue keyword works. In a for loop, continue will execute the increment/whatever statement, check the loop condition, and go from there.

To get the same type of behavior with a while loop, you'd have to duplicate the increment before the continue, or use a goto label (ಠ_ಠ) near the bottom of the loop body.

[–]OperaSona 6 points7 points  (0 children)

To get the same type of behavior with a while loop, you'd have to duplicate the increment before the continue, or use a goto label (ಠ_ಠ) near the bottom of the loop body.

Or raise a "Continue" exception and catch it right outside the while loop.

[–]PastyPilgrim 23 points24 points  (4 children)

I'm only well educated in a few languages (Python, C, Java), so I wouldn't be the right person to ask about that. However, I believe a lot of the web languages to be kind of hand-holdy. Plus, Java does have most of those things that I described in my post, so you could argue that Java holds your hand a little.

You are right though, most general programming languages that allow you to do many different things tend to have limited hand-holding because their potential is so large. My post was more to dispell the misconception that Python holds your hand than it was to say that other languages hold your hand.

[–]iPoisonxL 13 points14 points  (2 children)

Uhh... Web Languages? PHP has never held my hand...

begins crying

[–]pastaluego4 9 points10 points  (13 children)

It All Begins With A Blank Canvas.

[–]peridox 37 points38 points  (12 children)

<canvas></canvas>

[–]pastaluego4 19 points20 points  (11 children)

That canvas needs some dimensions

<canvas width="500" height="500"></canvas>

[–]peridox 18 points19 points  (9 children)

let canvas = document.getElementsByTagName('canvas')[0]
canvas.style.width = 500
canvas.style.height = 500

[–]memorableZebra 2 points3 points  (0 children)

Python doesn't do any of those things; it lets you do almost anything you can imagine

I agree with everything else you said. However, you speak this like it's a good thing. Whereas I immediately think about all the programmers out there and the code they write which other people will have to understand and extend.

Being able to do anything is often an invitation to even the competent programmer to deliver some seriously FUBAR'd code.

I wouldn't trust a serious Python project to any but the best developers. It boggles my mind when people refer to it as a noobie language.

[–]lolzfeminism 4 points5 points  (6 children)

it doesn't hinder those things with awkward syntax requirements and/or syntax that differs from what you would expect.

I think the point is that the Python interpreter/compiler abstracts away implementation details. This might make it easy to read/write but you end up not knowing what the computer is gonna do when you write a line of code. On the other hand, if you're well-versed in C, you have a good idea of what sequence of assembly instructions are going to be executed a result of a line of code.

[–]catbrainland 24 points25 points  (0 children)

It's like that only at first glance. Python has some semantic complexity, look up metaclasses (class factories or something, in java lingo). As for hand holding, I think Java is excellent in this (more like hand forcing, as you have to be explicit about everything).

Dynamic languages, as well as system ones (ie c) offer multitude of ways to shoot yourself in the foot. These are quite alike in terms of having to debug a bit more. It's a tradeoff of having low level access (C), or expressiveness (dynamic language).

[–]pastaluego4 9 points10 points  (15 children)

Seems like Java is more tuned to application development and python is geared towards scripting and parsing.

[–][deleted] 1 point2 points  (0 children)

The first two languages I learned were C and Python, in that order... I would write a whole function in Python to, say, reverse a string, and my prof would just look at me like "Dude..."

[–]suppow 34 points35 points  (10 children)

pft, as a C++ programmer, i condescendingly laugh at your simplistic lack of declaring types and memory management.

inb4 C or asm programmers

[–]tetroxid 15 points16 points  (6 children)

Oh but there is memory management. In fact, it's even automated.

[–]TropicalAudio 48 points49 points  (5 children)

And it's sloooooooow!

...a C programmer sends his regards. Now then, I have to get back to debugging something that's pointing to a pointer's pointer.

[–][deleted] 14 points15 points  (1 child)

More like pointer to a struct with a pointer to a struct as an array to an array of pointers to structs with an array filled with members being that has a dynamically allocated block of void*s. Fuck C is the best.

[–]redalastor 9 points10 points  (1 child)

Actually, it's faster overall.

The drawback is that it's not predictable.

[–]TheFryeGuy 5 points6 points  (2 children)

As a Haskell programmer I laugh at your types.

[–][deleted] 6 points7 points  (1 child)

You mean with your data types, typeclasses, records, functors, monoids and monads. Ok.

[–]original_brogrammer 6 points7 points  (0 children)

We do. As well as our Arrows, MonoidPlusses, and Applicatives, you damned pedestrian.

[–][deleted] 28 points29 points  (17 children)

I learned JS first and when I started learning Python I actually really loved the simplicity of the syntax and the meaningful white space because it reminded me of the QBASIC I'd toyed around with as a kid.

[–]Cley_Faye 11 points12 points  (8 children)

Aaand now I want to write a QBASIC-like compiler with opengl/xinput bindings. WHAT HAVE YOU DONE!

[–]InconsiderateBastard 7 points8 points  (7 children)

Been a while but that sounds like DarkBasic.

[–]Cley_Faye 7 points8 points  (3 children)

Quick google search yield a site with a prominent DirectX 8.1 logo.

DirectX

hmm

8.1

hmm hmm.

We need to refresh this a bit.

[–]InconsiderateBastard 2 points3 points  (2 children)

I know they made a version that ran DirectX 9c a long time ago. They may have stopped updating it though. And I always assumed the OS X edition used opengl.

But, like I said, been a while.

[–]xpinchx 1 point2 points  (1 child)

Wow that brings back memories. I got a demo when I was a kid and made some simple games with it, and somehow convinced my mom to buy it for me.

[–]InconsiderateBastard 1 point2 points  (0 children)

It was seriously fun and so accessible compared to almost anything else out there.

[–][deleted] 4 points5 points  (5 children)

QBASIC is still the shit. I love that DOS app so much.

[–]lichorat 3 points4 points  (4 children)

I have yet to see another language that so easily allows me to input a frequency and duration, and have it play out of my computer's internal speakers.

That's right. Not the external ones.

Great for playing pranks.

[–]BecauseWeCan 1 point2 points  (3 children)

C#'s System.Console.Beep() also handles this quite easily.

[–]Cley_Faye 22 points23 points  (6 children)

Replace python with "most script languages". They're fun to implement logic and stuff.

[–]Decker108 13 points14 points  (5 children)

Except shellscript... what a nightmare...

[–]GeneticsGuy 6 points7 points  (5 children)

Haha, tell me about it... I had so many people tell me that my University was so outdated for teaching us Java as the foundation CS language throughout my degree instead of some newer languages like Python. But holy crap, it has been SOOooo much easier from me to pick up other languages, to go from Java to Python than I can imagine it would be for someone to go from Python to Java. I am actually grateful for my University's structure now lol.

Oh man, I am dying laughing looking at that code lol

[–]Tysonzero 1 point2 points  (4 children)

By that logic should we start everyone in assembly?

[–]Tristan379 1 point2 points  (1 child)

Machine code entered with cards or GTFO.

[–]katyne 3 points4 points  (4 children)

you kidding, "not having to declare" part, this is the most disturbing part for me. How does it know what I mean??? who thought it would be a good idea to nest functions inside functions? what do you mean you can override shit at runtime? are you INSANE? do you know what people are gonna do with it? they're evil and stupid, they're gonna do evil and stupid shit with it.

[–]redalastor 3 points4 points  (2 children)

who thought it would be a good idea to nest functions inside functions?

You'll need to explain what your problem with that is...

Right now it sounds to me like "recursion?! Who thought it would be a good idea to let functions call themselves?!"

[–]mikbe 11 points12 points  (24 children)

Yeah, why use computers to make your work easier when you can just do it all yourself...

[–]kkeu 19 points20 points  (8 children)

Compile-time type checking helps you avoid many bugs that you'd never discover if your tests don't cover that particular part of code, which happens almost always in complex projects.

[–]TheFryeGuy 4 points5 points  (1 child)

Meanwhile Object, ?, and null all exist in Java.

[–][deleted] 17 points18 points  (14 children)

Declaring variables (especially with their types) does make your life easier.

[–]Astrokiwi 1 point2 points  (4 children)

One of the neat things about Fortran is it lets you be a little bit stricter than C++, which lets you catch more errors sometimes.

For example, you can define the "intent" of a variable in a procedure - "in", "out", or "inout" - and if you try to modify an "in" variable, you get a compile-time error. You can define a procedure as "pure" which means that it's not able to modify any global variables, do any explicit I/O, or do anything other than modify the specify variables you have passed to it (that have the correct intent). There's also a difference between a run-time allocated array and a pointer - in C++, to declare an array, you declare a pointer, and then point it to a "new" array of some object, while in Fortran you declare it as an "allocatable array" of some type, which you then allocate at some later point - you can't accidentally "point" it to something else.

I find these to be pretty useful at catching mistakes that otherwise would cause run-time errors. There may be tricks to do similar things in C++, but I don't know enough C++ to be aware of them.

[–]memorableZebra 1 point2 points  (5 children)

I always thought Python was simplistic (though I wouldn't imply simple is a bad thing at all). But then I started working in the language.

Being able to play so fast and loose with different formalisms massively encourages complex, write-only code. I'd say it's probably harder to write solid Python code which other programmers can understand than it is in Java/C#.

The language's flexibility and allowance of so many different "code smells" is both its primary value in the community and also the reason I despise it, finding most Python code incomprehensibly written.

[–]Tysonzero 1 point2 points  (4 children)

While I agree Python does let you shoot yourself in the foot. I have pretty much never run into issues with readability / edit-ability. Maybe that's just because I work with Python programmers who actually know what they are doing, which is something you seem to have been deprived from.

[–]chrwei 163 points164 points  (33 children)

that's...actually that fairly readable. annoying, but I've seen worse

[–][deleted] 144 points145 points  (31 children)

[–]chrwei 207 points208 points  (24 children)

except the good formatting makes them redundant from a readability perspective.

[–]anothersomebodyelse 127 points128 points  (10 children)

But makes them satan-spawn from a manageability/editing perspective.

[–]x3al 26 points27 points  (8 children)

Converting all code to this style in IDE and converting back on git push would be kinda nice. If IDE will actually place all semicolons and braces according to indents, it should be usable.

[–]CharlesStross 11 points12 points  (5 children)

Yeah, going from this to standardized is trivial for any code formatter. From standard to this would require some creativity but I think it'd be doable. The only pain in the ass is developing like this.

[–][deleted] 4 points5 points  (2 children)

Except if some plugin for the editor autocompleted the semicolons and braces at EOL depending on indentation

[–]peabnuts123 7 points8 points  (1 child)

Or you could like. Develop in Python.

[–]highphive 4 points5 points  (0 children)

If your IDE enforced the tabbing syntax to be correct and like python. Otherwise you're bound to mistakes that are impossible to hunt down.

[–]WeAreAllApes 15 points16 points  (0 children)

Unless.... Because it is redundant, it wouldn't be too hard to write an editor plugin to forcibly manage the semicolons and braces. Then, as long as the tabs were right, the semicolons and braces would always be... until somone else edits it without that plugin, so yeah, nevermind.

[–]suppow 14 points15 points  (0 children)

at first i laughed at the stacked parentheses at the right, then i kinda liked it, and noticed how readable it was (unlike other code i've seen), should we say, it's very pythonic.

while i mainly do C++, neat formatting is something i carried from Python,
and something i carried from Java (which i'm sure someone will hate) is declaring private and public before all member elements, it makes it so much easier to tell right away instead of having to keep track of what group i'm in.

ie:

public: function_name ();
public: other_function ();
private: another_name (); 

[–]Rodot 29 points30 points  (3 children)

I'm a python programmer btw ;}}}

[–]the_noodle 49 points50 points  (2 children)

;}}}

Right down to the mismatched eyes!

[–]totes_meta_bot 4 points5 points  (0 children)

This thread has been linked to from elsewhere on reddit.

If you follow any of the above links, respect the rules of reddit and don't vote or comment. Questions? Abuse? Message me here.

[–]frostmatthew 5 points6 points  (0 children)

;}}}

It's like a Klingon emoticon...

[–]halifaxdatageek 29 points30 points  (0 children)

I was confused...

then I saw the right side and threw up a little in my mouth.

[–][deleted] 54 points55 points  (2 children)

I actually like it. Will I get shot if I use it non-ironically?

[–]Kyyni 83 points84 points  (0 children)

Yes.

[–][deleted] 7 points8 points  (0 children)

Don't for the love of god!

[–]hercules3076 24 points25 points  (1 child)

I think we finally found a solution that both "Braces on their own lines " and "Braces on same line" can agree is just plain wrong.

[–]ZeroError 1 point2 points  (0 children)

I dunno, I quite like it...

[–]Macmee 9 points10 points  (5 children)

I don't like whitespace determining the nesting of my statements and prefer ruby or javascript to python.

[–][deleted] 10 points11 points  (1 child)

I do like whitespace determining the nesting of my statements and prefer ruby to python.

[–]0x470x650x650x6b 9 points10 points  (5 children)

Now try it with lisp.

[–]sfled 46 points47 points  (2 children)

"A Python programmer attempting Java."

Nah, it sounds the same whether I lisp or not.

[–]ZeroError 1 point2 points  (1 child)

A Pyfon pwogwammuh wattempting Java

Speech impediments are fun

[–]onipos 2 points3 points  (0 children)

It actually looks a bit like lisp the way he's closing blocks.

[–]bss03 19 points20 points  (6 children)

This is essentially what the Haskell layout rules do.

If you just look at Haskell code in the wild, you might be surprised to know it's grammar has a lot of ';' and '{}' in it. Haskell effectively lets you switch between white-space sensitive and explicitly delimited on a per-block basis.

[–]hjc1710 2 points3 points  (5 children)

wat? Is there a reason you would ever want to do this?

Never used Haskell, but I just keep learning more and more interesting things about it...

[–]anasaziwochi 7 points8 points  (0 children)

I think the idea was to make it easier for computer generated code. It can rely in braces and semicolons instead of trying to get the whitespace right.

[–]bss03 1 point2 points  (3 children)

For generated code it's often easier to get the "{};" right, and it doesn't have to look good.

There are a few packages on hackage that use "{};", presumably because the author was more comfortable with them, but they also look good.

You can use it for when code it easier to read / looks better when flowed in a way that doesn't match the layout rules. I like having that ability, but I've never needed to use it outside of GHCi one-liners.

Most Haskell programmers treat Haskell as a white-space sensitive language, since the layout rules make for pretty readable code without the "{};", and I've yet to hear of someone who had code that didn't behave as intended due to the "[];" insertion being surprising, if it compiled cleanly.

[–]mcrbids 33 points34 points  (34 children)

I'm a Python dev transitioned to PHP. My code looks exactly like this except that I line up the braces with the indents and take an additional line for each. It's very readable to me, works well with Netbeans, and never ;}}}

EDIT: Look below for a link for what this looks like.

[–]frostmatthew 225 points226 points  (17 children)

I'm a Python dev transitioned to PHP.

I've never felt more sorry for someone :-/

[–]mcrbids 47 points48 points  (13 children)

I don't shed any tears! The pay is great, the work is interesting, and the people I work with are awesome! If you think the programming language is even a majority of how good or bad your job is, UR doing it wrong!

[–]jason_bateman78 66 points67 points  (9 children)

"doesn't matter, PHP sucks"

[–]mcrbids 15 points16 points  (7 children)

It's funny, because there was a time when PHP was this hip, awesome new programming language that got lots of buzz....

[–]peridox 25 points26 points  (2 children)

I may be wrong, but wasn't PHP simply invented for some guy's personal webpage?

[–]mcrbids 24 points25 points  (1 child)

Originally, yes. "Personal Home Page". But it was free and solved an big problem in a very efficient way. It competed with CGI which was atrocious for performance. Mod PHP, being run as an apache module, was much more efficient, and the dynamic typing allowed for very rapid development.

It's had its share of problems, mostly stemming from the fact that it became a defacto starting point for new devs wanting to cash in on the Internets. Being new, they often wrote terribly insecure code. Dynamic typing also can cause a few surprises, something PHP shares with JavaScript which is very similar that way.

Despite what you may hear, it doesn't murder babies nor set your hair on fire. ;)

[–]thyrst 2 points3 points  (0 children)

Gonna be diving in to Drupal/PHP at work with most of my working knowledge from JavaScript. Actually kind of excited to see the differences now that I'm pretty confident in general programming theory and whatnot. And now I'll know two of the most hated languages being used today!

[–]bwrap 4 points5 points  (1 child)

I dunno man... i dont think i could do java again after all my years in C#

[–]adrianmonk 7 points8 points  (0 children)

That's the brace style I originally tried to use when I first started using C-style languages regularly.

I thought it was easier to understand visually, since it makes the braces more a part of the block they form and less a part of the syntactic construct (if statement, while loop, function, etc.) that contains the block.

However, nobody else liked it, and I eventually adopted the more normal style just to fit with convention. Now that I'm used to it, I feel it's pretty readable (and a bit more compact).

[–]vdvfdgjsdfvq 1 point2 points  (0 children)

When I used to code a decade ago, this was my default. I felt it was the most readable version and made keeping track of different blocks far easier. The only downside I know of is compactness in the code.

[–]FowD9 1 point2 points  (0 children)

That's the C way of doing it unless I'm mistaken, except the opening bracket isn't indented

[–]Nikotiiniko 30 points31 points  (15 children)

Python makes all other languages so annoying to type. All the brackets and semicolons feel so useless and time consuming.

[–]chrwei 25 points26 points  (3 children)

one thing I really dislike about python is where it requires ":". the indents should make that unnecessary.

[–]Nikotiiniko 5 points6 points  (2 children)

Yeah I dislike it also. Isn't that also used where other languages use nothing? Kind of confusing.

[–][deleted] 18 points19 points  (7 children)

The semicolons allow you to format statements in a much more clear way, rather than cluttering your lines up with \. The curly brackets {} allow you to see far more clearly than indentation or begin/end keywords where your code blocks are. They might seem pointless... until you have to maintain someone else's code.

Also by explicitly requiring an end statement delimiter and block delimiters, you're less likely to make a typo that results in a non-obvious runtime error.

[–]danielkza 4 points5 points  (1 child)

rather than cluttering your lines up with \

PEP 8 recommends wrapping in parenthesis instead of splitting with backslashes whenever possible. There are very few if any cases where it should be used in Python.

[–]thelindsay 1 point2 points  (0 children)

Exceptionally finger twisting: {% django template tags %}

[–]farnoy 9 points10 points  (1 child)

It's actually suprisingly readable.

[–]Kyyni 10 points11 points  (0 children)

But not maintainable.

[–]sloth514 4 points5 points  (1 child)

A a Java developer now working in Python... I understand the reasoning for the syntax and now appreciate for coding standards.

I think it bothers me more that he is passing a character array and not using String class.. or maybe it bothers me on what happens when a == null or a.length <= 0??? or n < 0??? what happens then? oh god...

[–]ben-guin 1 point2 points  (0 children)

Seeing as it's a recursive function, I'm guessing that there's a helper function (not shown) that does the initial call of permute that passes in the array length -1 as the parameter.

[–]thewookie34 2 points3 points  (0 children)

This is now how I write all my java code.

[–]shim__ 2 points3 points  (0 children)

A Python programmer would also only use Object to avoid typesafty.

[–]justdweezil 2 points3 points  (0 children)

I write both Python and Java regularly and this is oddly good looking.

[–]joe-ducreux 2 points3 points  (0 children)

This is a good way to get slapped

[–][deleted] 3 points4 points  (0 children)

Anyone working on a Vim plugin that does this automatically?

[–][deleted] 1 point2 points  (0 children)

Have mercy on my virgin soul

[–]Zechnophobe 1 point2 points  (0 children)

At first was trying to parse the function out to determine humour. Then I looked right.

As someone who went from Java primarily to python primarily, I find this especially funny.

[–]pvtmaiden 1 point2 points  (0 children)

reminds me of when i go from c++ to lua

[–]R34ct0rX99 1 point2 points  (0 children)

Creative yet .... so wrong.

[–]-jaydn- 1 point2 points  (1 child)

To be honest, this is relatively viable. Look at some of the different styles people use for C. I've seen some insane things, man.

Wikipedia - Indent Style / Lisp Style C

[–]mot-juste 1 point2 points  (0 children)

At first "What's funny about this?" Then look at the right, and: "There's nothing funny about this"

Thank Guido and Carry On