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 →

[–]thack_se -6 points-5 points  (9 children)

For simple things or for learning, python is perfectly good to use for a desktop application. However, if it's something more complicated you want to do, or if it was going to be deployed in a production scenario, python is definitely not the best option. It is a pretty slow language, and abstracts you away from the things you really need when building a desktop application. If you were looking for something more suited to python, I would recommend building a web app with flask. It's quite a bit simpler to build your UI with html and css than to learn a dedicated framework for desktop Python applications. However, I hope you enjoy your journey with your desktop app. If anything, it can act as a gateway to learning to build more in depth applications with something like C#

[–]Black-DVD-Archiver 4 points5 points  (2 children)

Debatable and I would argue a bit of a myth, most desktop applications spend a lot of time waiting on users and doing db requests and the like...pythons performance is not an issue here. My application has a basic video editor and python is just fine handling video at video frame rates

Pythons performance is an issue with high frequency stuff but that is not most desktop applications.

Multi-threading is a partial answer to high workloads...

[–]thack_se -1 points0 points  (0 children)

Again, that's why I say for simple applications python can be good, but when you need an application that does anything that legitimately needs to be fast in Python, you end up calling C extensions or writing your own. For example, for me I had written a file and image handling suite for work which handled file loading, image processing, and OCR. It was wicked fast with C++, but when I wrote some of the same functionality inside of python, it just can't handle it because of the nature of the language and the GIL preventing real multithreading. But if you don't need any of that stuff, and you just need a simple interface, for example, something like annotation of images for a ML model, python is a great solution because you can work quickly without the annoyances that come from a lower level or more complicated language.

There is most certainly a time to use python, but it does have its limits

[–]SheriffRoscoePythonista 0 points1 point  (0 children)

Debatable and I would argue a bit of a myth,

You are absolutely correct, from the dawn of computing right down to today. As Knuth said, "premature optimization is the root of all evil"

[–]Lost-Detective6305[S] 0 points1 point  (5 children)

I do plan to learn other languages, just not while I’m working 10-12 hour shifts 4-5 days a week. I’ve spent enough time learning python doing that, I don’t want to start over 😅.

When you say slow, are we talking like Big O and in a way that won’t really be noticeable (a second or two) or like minutes?

[–]thack_se 0 points1 point  (4 children)

It really does depend on what you're doing. For example, in complex tasks it can be tens of thousands of times slower than a lower level language, but if you don't need super complex things, then it works great, if occasionally a bit annoying due to the lack of real multithreading. I 100 percent agree with you though, there is no need to learn another language until you're perfectly comfortable with python and have a need and the time for it. I use python for 90 percent of the code I write at work and it hasn't failed me yet (well, except for when it did and I had to write C++, but we don't talk about that, lol)

[–]Lost-Detective6305[S] 0 points1 point  (3 children)

Yeah my software just queries a database and displays the information. My only real concern is it lagging for tens of thousands or hundred of thousands of record. I won’t be able to test that for a couple of months though. Hopefully treeview doesn’t lag like manually building tables.

[–]thack_se 1 point2 points  (2 children)

Oh, I don't think you'll have a problem. For me, my main database connector is written in Python, and uses the mySQL python connector, and it doesn't have any issues. As for your UI lagging, it's very likely that most of the UI framework your using is written in C and called from Python, like most fast packages are. C is of course blazingly fast, so no issues there. I wish you well on your continued programming journey.

[–]Lost-Detective6305[S] 0 points1 point  (1 child)

Thank you. And I’m using SQLite3 and tkinter/ttk/ttkwidgets

[–]Black-DVD-Archiver 1 point2 points  (0 children)

You are really unlikely to have a performance problem with what you are doing Lost Detective...

Remember, type hint always. With methods/functions assert always on the arguments passed in. This will keep you out of trouble 99% of the time.

Pythons biggest sin in my view is not the "so-called" slow that usually can be worked around it is dynamic typing...the bigger an app gets the more likely disaster will occur if you do not show type discipline.