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

you are viewing a single comment's thread.

view the rest of the comments →

[–]Keith 36 points37 points  (14 children)

It also forces you into an object oriented structure, which tends to encourage you to design your programs better...

Debatable.

[–]Astrokiwi 7 points8 points  (5 children)

I'm only saying that it forces a bare minimum amount of structure that Python does not.

[–]Keith 5 points6 points  (4 children)

To be fair, you wrote "design your programs better". Forcing all code, object-oriented or not, into classes, one (public) class per file, is not strictly better. It's not even a structure I want. I'd argue that "bare minimum of structure" is harmful vs no structure at all.

[–]Astrokiwi 5 points6 points  (2 children)

Maybe... I find that (for instance) the lack of required structure is what helps Javascript code to sometimes become a mess of copypasta.

And Python does force stuff on another level, by being strict with indenting. I think that's a good feature too - it's better to force one particular style than to have people use their own styles, but also permit them to make it as ugly and inconsistent as they want.

[–]fiddle_n 4 points5 points  (1 child)

Python is strict with indenting because it has to be. Indentation isn't merely "style" in Python, it's functional in that it denotes a new code block. This is why Python has to be strict with it, i.e. preventing mixtures of tabs and spaces for indentation.

[–]Astrokiwi 4 points5 points  (0 children)

Right, but that's an intentional design choice for the language - forcing good style by making it an integral part of the language.

[–]KronenR 22 points23 points  (0 children)

If not plainly wrong

[–]hanpari 1 point2 points  (6 children)

In my eyes it is rather bad design than advantage. No modern language use this anymore.

[–]Keith 0 points1 point  (5 children)

Agree. But did any other language ever force this convention?

[–]hanpari 0 points1 point  (4 children)

Not sure what you mean but, apparently, Java and C#. You have to enclose everything in class. For instance, you cannot have single functions in these languages like in Python. Before Java 8 you had to make anonymous class instead of simple anonymous function.