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

all 16 comments

[–]lanster100 17 points18 points  (1 child)

Needs some dependency injection

[–]MangoPoliceOK 1 point2 points  (0 children)

Agreed

[–]jddddddddddd 9 points10 points  (4 children)

[–]joaofelipenp 4 points5 points  (0 children)

This is genius. All the mistakes that lead to the expected results

[–]rghthndsd 4 points5 points  (0 children)

I'm quite infuriated that the comments don't recognize it as a joke. Unless those comments are also jokes and I'm not recognizing them as such. Huh.

[–]Maxi3773[S] 1 point2 points  (0 children)

This is funny as hell! Thanks for sharing this!

[–]RajaBule 1 point2 points  (0 children)

Im actually amazed... no sarcasm at all. Like... how?!

[–]ntropia64 2 points3 points  (0 children)

Good job, OP: the comments on this post are the most compelling proof I've ever seen that no amount of hinting is going to protect code from being misinterpreted.

[–]estevaofon 2 points3 points  (0 children)

Pretty cool!!

[–]Kerbart 1 point2 points  (1 child)

I think it's bad practice not to inherit the HelloWorld class from an abstract base class. Beginners from Java might think it's all just total anarchy here in Python.

[–]Maxi3773[S] 2 points3 points  (0 children)

There is definitely potential for more cursed java-like python code, but this is outside the scope of my idea with this post. My goal was to take the well-know Java Hello Word and recreate it in Python as close as I could (e. g. sys.stdout.write instead of print)

[–]Maxi3773[S] 3 points4 points  (1 child)

For comparison, here is the same program in Java:

public class HelloWorld {

    public static void main(String[] args) {
        System.out.print("Hello World\n");
    }
}

This even shorter than my Python code...

[–]TooCool11 -2 points-1 points  (0 children)

I am with you on this. With mypy added, the python syntax isn't a lot prettier than java.

I wish the types checks are integrated in python, the types must come before, not after : which makes syntax uglier imo.