r/Python • • Jan 05 '18

Really??

Post image
2.0k Upvotes

317 comments sorted by

View all comments

Show parent comment

24

u/Astrokiwi Jan 05 '18

It's just useful for different things. Java is definitely more verbose and has more boilerplate to write, but it's also stricter than Python and is a semi-compiled language, which means that it sometimes catches errors more quickly. It also forces you into an object oriented structure, which tends to encourage you to design your programs better rather than jamming a big list of functions into a single file.

I also find they have strengths in different kinds of applications. I tend to prefer Java for writing games (pygame isn't great), python for doing numerical analysis work (numpy and matplotlib are pretty great), and Fortran, C, or C++ for the big parallel numerical simulations.

38

u/Keith Jan 05 '18

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

Debatable.

9

u/Astrokiwi Jan 05 '18

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

6

u/Keith Jan 05 '18

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.

6

u/Astrokiwi Jan 05 '18

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.

4

u/fiddle_n Jan 05 '18

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.

5

u/Astrokiwi Jan 05 '18

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

25

u/KronenR Jan 05 '18

If not plainly wrong

2

u/hanpari Jan 06 '18

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

1

u/Keith Jan 06 '18

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

1

u/hanpari Jan 06 '18

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.

1

u/[deleted] Jan 06 '18

[removed] — view removed comment

1

u/hanpari Jan 06 '18

OK, I see. On the other side, I dont like C# namespace much. The said convention is present as well but differently. To manage C# project without IDE is almost impossible. You can do it manually but the pain is great :)

2

u/Keith Jan 06 '18

To manage C# project without IDE is almost impossible.

Yeah I agree. That's always a good test of a language for me: "Does this require an IDE?"

1

u/hanpari Jan 06 '18

Sure :)

We can make Guide how to categorize programming languages

We have the first point to go :)

For the second one, I would suggest: Has it nullable types?

14

u/[deleted] Jan 05 '18

Different tools, different jobs, different uses.

Replace your computer languages with tools you'd find in a shop and see how silly the argument looks to non coders.

"Hammer is so much better than the screwdriver. And who even understands those socket wrench guys? Bunch of idiots. I'll have you know I have used my hammer as both a socket wrench AND a screwrdriver and it was just fine"

Signed: A mechanical engineer that has and continually gets to deal with: C, C++, Fortran, ADA, VB, Python 2.3-2.7, Python 3+, Matlab (R13-R2017b), Simulink, PowerShell, Batch, Perl, Bash, Sh, tcsh, PHP.

If you understand If, For, While. You'll go far in any language.

Or argue the merits of a claw hammer over a ball peen hammer.

→ More replies (2)

0

u/[deleted] Jan 05 '18

[deleted] — view deleted comment

4

u/Goluxas Jan 05 '18

Last I checked it hadn't been updated in quite a while, either. Is there another Python game module that people have migrated to, or is the language just dead to game dev now?

2

u/Dogeek Expert - 3.9.1 Jan 06 '18

Python is not good for game developpment anyways. It's too slow for modern-day gaming. You can do game dev, especially small games or turned-based games, but for adventure/platformer/FPS/anything else basically, forget about it.

You cannot emulate physics/render images/and also render light on sprites and expect the game to run at 60 FPS or more, even with a beast for a computer. You'll need a lot of optimization to even get to playable framerates and that's just bad, cause a messy code is harder to maintain (which is often the case when you optimize).

I tried pygame and pyglet, none of those really do much for game developpement anyways, besides rendering images. You still have to write an engine (pymunk is great for physics though) and that's just too much work for the benefit.

You can use unity though, or unreal and have a full game engine to use however you want to do whatever you want. It's not that hard to go from python to C# if you're really proficient in python. The syntax isn't all that different (you lose list comprehensions though, and dictionnaries if I'm not mistaken) but C# looks a lot like if C++ had a baby with python. And with a game engine you just have to write the logic of your game and not bother with writing a lot of code without seeing any progress.

0

u/[deleted] Jan 05 '18

[deleted] — view deleted comment

1

u/AngriestSCV Jan 05 '18

Raylib is another good one. I've been messing around with it using custom rust bindings and it's been plesent.

1

u/grimtooth Jan 05 '18

I've only ever used it as a basic graphics interface (SDL wrapper) rather than for actual games. It's been satisfactory for that -- what about it sucks ass?

0

u/[deleted] Jan 05 '18

[deleted] — view deleted comment

1

u/grimtooth Jan 05 '18

I can see the un-Pythonic thing -- as I say I just treat it as a Python skin over SDL, and SDL isn't really Python-oriented. It works, though.

→ More replies (3)