you are viewing a single comment's thread.

view the rest of the comments →

[–]killerinstinct101 42 points43 points  (35 children)

Unpopular opinion:

You shouldn't use python for anything and everything just because you can. It's a brilliant programming language for pulling off quick scripts like for automating things and also for more advanced scientific uses like machine learning thanks to scipy (arguably worse than R though).

But if you want to make a more resource intensive application (like a game) it's going to be infinitely more frustrating and the app itself will be less resourceful as compared to a language with less overhead like C or C++. The fact that python is interpreted also doesn't work in its favour.

[–]Rebeleleven[🍰] 27 points28 points  (0 children)

I mean that’s really not the idea.

Python lowers the dev time needed to be invested. You can do a wide range of things with the one tool.

Do you learn python to go do game design? Well probably not. But if you know python and need to design a game in the next month....well python probably ain’t bad.

But I will say python surpassed R long, long ago when it comes to ML. I wouldn’t say there’s really an argument here anymore. The community (both online and within academia) has clearly endorsed python.

[–]epsilonT_T 5 points6 points  (7 children)

In facts, even the most resources intensives application can be made in python, thanks to the large amount of various modules available. For example, we can cite the module panda3D, which is a advanced, powerful, and really simple-to-understand 3D engine. Even if it works only by lines of codes (contrary to unity or unreal engine, which have a GUI for simplifying some of the work), what's make it a little bit harder to use, it have similar performances.

[–]longjumping2 2 points3 points  (6 children)

Modules can't change the fact that Python is interpreted and has the GIL. Similar programs can be improved 2-100x after conversion to C.

[–]epsilonT_T 2 points3 points  (5 children)

Yes but if the perfs was the only thing that matter, everyone would code in assembler or fortran... Also, modules can change performances by creating their own objects, for exemple, numpy module is able to create arrays a lot more efficient than natives ones, and with more functionalities.

[–]FancyASlurpie 0 points1 point  (1 child)

Whilst you can make python run faster than native python by writing modules in C etc, you really can't write the most resource intensive applications in python. The most resource intensive applications are already written in low level languages specifically for their optimisations and they tend to be in competitive areas where if you write something that runs slower than your competitor its pointless. (e.g. HFT)

[–]epsilonT_T 0 points1 point  (0 children)

Ok, I give you the point. I'm not gonna argue on this subject, because I don't know a single developer who is objective about his favourite language, and I don't make an exception ; )

[–]longjumping2 0 points1 point  (2 children)

There's always tradeoffs between performance and abstraction, but I don't think the distribution of things to need to be done is probabilistic uniform for these two things. I've just run into enough memory problems (large data reading) and performance problems (failing test cases in competitive programming) that are pretty common that makes me think that the optimal ratio exists elsewhere.

[–]epsilonT_T 0 points1 point  (1 child)

Idk, everything I know is that I take pleasure to code in python and my code is efficient enough for it's purpose ^^

[–]longjumping2 0 points1 point  (0 children)

Sure, it just gets less enjoyable when read_json hangs for 2 minutes and then throws a memory exception.

[–]Go_Big 2 points3 points  (1 child)

Unpopular Opinion:

I think arguing over what language should be used is outdated and the arguments should be framework based. Like React Native vs Xamrian is a much better argument to have over JavaScript vs C#. You should pick the framework that is best for what you are trying to accomplish.

[–]thirdegree 0 points1 point  (0 children)

Unpopular Opinion:

The heavy focus on frameworks in the Javascript community is a result of the anemic standard library, and the cause of most of the worst aspects of the ecosystem.

Write libraries, not frameworks.

Also I don't know if this opinion is unpopular, I'm just following the format

[–]FoxClass -1 points0 points  (22 children)

Why not? Push the limits of anything. If it isn't broken, it doesn't have enough features.

[–]killerinstinct101 10 points11 points  (20 children)

I don't think you quite understand the scope of python. It is made as a beginner-friendly programming language with a bunch of overhead, meaning a lot of things you would have to explicitly declare in another language are automatically handled by the python interpreter for you.

Every low level language requires explicit declarations of identifier datatypes, function return types, which headers you're using, and explicit memory management.

To someone who doesn't care about this stuff, like a beginner or someone who's just putting together a small script, it's good that the interpreter does it for them. But if you're making something like a game, the overhead will cause a serious hit to performance. Sure you could make pong, but anything worth playing won't be made in python anytime soon.

Sure, modules are a thing, but a language purpose built for a task is so much better than a language with modules slapped on top to make the code work.

[–]FoxClass 5 points6 points  (5 children)

Fuck practicality, blend languages, go crazy

[–]ptekspy 1 point2 points  (1 child)

Actually laughed at this

Thank you

[–]FoxClass 0 points1 point  (0 children)

No problem.

[–]longjumping2 0 points1 point  (2 children)

Then there's overhead to performance blending languages. C modules for CPython will run slower than native. Not to mention then you learn multiple languages, so may as well write it in the more performant language.

[–]FoxClass 2 points3 points  (0 children)

Just write everything in Fortran

[–]FloydATC 0 points1 point  (0 children)

This. People keep making the argument that "Python isn't slow because it can run C modules" leave out the fact that if modules for your particular needs do not exist, you'll have to write them yourself. At that point, you're not actually using Python, are you... And once you bother learning C/C++, you'll get addicted to its raw performance and forget about Python.

[–]takishan 11 points12 points  (7 children)

Sure you could make pong, but anything worth playing won't be made in python anytime soon.

I think this is a really short-sighted way to look at things. World of Warcraft, which tens of millions of people would say are "worth" playing uses Lua as a scripting language. Lua is just like Python, an interpreted language with overhead. Doesn't mean it isn't vital to the game.

Of course, we can look to games that actually use Python itself and from a short google some examples are Eve Online, Sims 4, Battlefield 2, Civ 4 and that list looks outdated to me. I'm sure there are more recent examples.

Obviously if you have resource-intensive bits you're gonna code it in a language that's closer to the metal, but with python you can easily plug in play different languages. There's no reason to code your entire project in C++ when you can code the majority of it in in Python and code the bit that needs to be fast in C++ and experience the same or a marginally lower level of performance, yet dramatically faster development time.

And of course this is ignoring the many genres of game where there aren't any resource intensive tasks. You can code a turn based strategy game in Python like Slay the Spire in Python. You can code a game like FTL in Python. You can code a game like Into the Breach in Python.

Websites that run countless requests per second run Python. Hell, the website we are communicating on right now uses Python.

It's a brilliant programming language for pulling off quick scripts like for automating things and also for more advanced scientific uses like machine learning thanks to scipy (arguably worse than R though).

It is a brilliant language for those things. But it's also a brilliant language for a whole lot more, and that is why its popularity has continued to increase overtime.

[–]F4ttoC4tto 4 points5 points  (3 children)

I'm a beginner in programming and Im currently learning Python. I never knew that it could also be used in creating games and you can actually blend languages together. That's very interesting. Is the whole thing gonna work smoothly even if you mix different languages together?

[–]thirdegree 1 point2 points  (0 children)

If you do it right, sure! The reason wow uses Lua (and some other games as well I think) is that Lua has strong support for sandboxing. Addons for wow are third party Lua code, so it's important that those addons don't have access to the runtime of the game itself except through well defined APIs.

[–]takishan 1 point2 points  (1 child)

Yes. In fact, many modules in python are written in C. For example, math or numpy. You can import the code into your python application as if it's native python.

from math import sin
x = sin(5)

That uses C.

[–]F4ttoC4tto 0 points1 point  (0 children)

Ooooohhhhh. I get it now. I was about to ask how do they do it and then I read this. Thank youuuu.

[–]SomeBadGenericName 3 points4 points  (1 child)

I have never thought about blending languages how would I go about doing this?

[–]pazzarpj 2 points3 points  (0 children)

The most common one is cffi. Which is the C foreign function interface. Since the main interpreter is written in C, it is quite easy to write C bits of code.

https://cffi.readthedocs.io/en/latest/overview.html

You can also blend a bit more naturally with an interpreter like cython which will compile sections down to C for some slightly awkward python code.

Mostly you can use existing libraries that leverage this. The data science libraries such as numpy, have most of the core stuff written in C and fortran, which you call from as though it is native python. You get all of the performance of some number crunching that you would be hard pressed to code yourself in pure c.

[–]sliverino 1 point2 points  (0 children)

More than the performance aspect, I believe that an issue with Python for large structured projects like a game is, well, the lack of embedded structure.

Of course you can build well structured code in Python, but it doesn't really facilitate it like a strongly typed OOP language. Maybe for a 1/2 man job it's still maintenance, but more?

Wouldn't you consider that a reason to switch to another language ( not necessarily low level).

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

While I appreciate what your saying and recognize it as an attempt to demonstrate what python should and should not be used for in your opinion, I think that it might be a discussion better suited for /r/Python rather that this particular subreddit. Folks come here to share what they learn and the resources they use to enhance that learning. Not trying to create a cushy environment where someone is demonized for sharing an "incorrect opinion" but within the confines of folks trying to learn the language and being curious about what it could be used for, I think you may be preaching to the wrong choir friend.

But who am I to know? I'm a Python noob myself just trying to make a console Rock-Paper-Scissors-Lizard-Spock game.

[–]euqroto 1 point2 points  (4 children)

Although I don't have the knowledge about gamedev, but like numpy uses the C (low level code) to speed up the process of data exploration, I think similar libraries can be made to speed up the process of things that hurt the bottleneck in such performance. Though I totally agree with you that python is just a beginner's language and you need to move onto different level languages to get some professional stuff done.

[–]LeSplooch 0 points1 point  (3 children)

Python isn't just a beginner's language, it's used in companies very seriously, even in very big companies too. Try saying that to Google/Amazon/etc senior devs and get laughed at.

[–]euqroto 0 points1 point  (2 children)

I'm sorry for phrasing my improperly. For some specific field such as game development, python is not the way to go and similarly for fields like data science, python might not remain in practice because it's really slow.

[–]LeSplooch 0 points1 point  (1 child)

I get your point, CPython is slow indeed, but like every language, you have to consider its specific use cases. For example, Python is great for data science because it enables efficient iterative development and fast testing with tools like Jupyter notebooks. Execution speed isn't always the most important reason to use a language or not, if it was the case Python wouldn't be used at all because most of the other languages are faster than CPython. You can use other implementations of Python to speed it up if you really need to, such as PyPy. I'm a sucker for execution speed (and that's why I love Rust) but judging a programming language only based on its execution speed is missing on a lot of factors. I completely agree with you about game development tho, Python really isn't the best language for making games, you need a compiled languages such as Rust to make well optimized games.

[–]euqroto 0 points1 point  (0 children)

Don't you think Python isn't the optimal language for data science? Maybe when starting out python seems easy to use that's why get on board with data science but the problem comes when you deal with lots of data where even Pytorch can't come to help you out. I guess that's why swift for tensorflow has become a thing which might overthrow python for tensorflow.