Is python a good choice to build a desktop application? [closed] - python

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I'm wondering if python is a good choice to develop a desktop application for a small business.
Is it possible to build something using PyQT or even Swing + Jython ? How I can make a executable file at the end?

I've found Python to be an excellent choice for developing a broad scala of applications including desktop applications. I've developed in C++ for many years, and for parts that are really time critical I sometimes use it still, but for most of my code Python helps me get results much faster. There are several ways to get an executable. Py2exe is one of them, Cython another option allowing easy combination with C++ if you need raw speed, interfacing with 3rd party libaries or low level control of devices. It also makes reverse engineering a bit harder, if that's a concern in your project.
By the way, when I started out with Python I was very concerned about performance and (being a quality manager at that time) almost blocked its introducion in our company for its lack of strickt typing. I was wrong about both. Since especially the rich set of built in datastructures as well as many of its standard modules are written in C++ and have been carefully optimized, it isn't so easy to beat on speed and memory efficiency as one might think. And the dynamic typing (only recently introduced in a language like C#) proved a very powerful means to write concise, readable, reliable and compact code.
I don't have shares (since Python is open source anyhow) but from all the languages I've used in the past (Algol, Pascal, Modula II, Assembler, Basic, Fortran, Cobol, C, C++, C#, Java, JavaScript) it's the one I prefer rightnow to earn a living with.

It depends on what you are looking to do. I have done it and it worked but there are other questions that can factor in like who will maintain or update the code, and do they know Python. You can look at cx_freeze for making a windows executable out of a python program as one of many options.

Related

Python C/C++ Wrappers versus Pure C/C++ Performance [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I've been doing some projects in computer graphics that have revolved around using open source libraries written and C/C++ that were then turned into wrappers for python.
I want to know if the performance gains for turning it into pure C/C++ would be worth the significant time it would take to rewrite the code base.
I also know C/C++ is almost always faster than python, but considering the libraries are already a C/C++ wrapper I'm not sure how much of a performance increase I should expect. I'm not looking for an exact answer since it very much depends on the circumstances, but if anyone has a general rule of thumb that'd be great!
Without seeing the code, in general it depends on
the granularity of the API, i.e. how much work is done by Python in relation to native code (or how often is control returning to Python),
whether Python code is on the critical path (some computer graphics libraries run the hot path in a separate, entirely native thread),
whether any compromise with regard to data structure in order to interface with Python was put in place.
Generally speaking, with a well-designed Python native library, there is little, if anything, to gain in terms of performance.
So I would start by profiling the Python code, to see if there is anything to gain.
Note also that C++ code is not fast by definition; it is only fast when it was engineered to be fast.

GUI programming without OOP [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I have a background in structural programming (Pascal,Ada) and now I have been programming an app in Java because I needed to use a given package that was only available for Java,C++ and Python. I chose Java, but I think it was not the best idea as I am not into OOP and I am programming it in a structural way, this is, only with methods and the main program,avoiding to generate objects and those Java things.
Now that I have the "app" running in the windows console I need to generate a GUI to operate it, but before going to hell with Java and objects I would prefer to change to another programming language that permits me to constract the GUI with my structural programming mindset (if it is possible).
I have read that Tkinter in Python and GTkAda in Ada could be my saviours. In case of not being possible I guess I should try to get into OOP.
Thanks in advance
GtkAda is also object-oriented, and so is any other high-level GUI toolkit I've seen so far, so I don't think you can avoid object-oriented programming for the GUI, unless you use a more low-level approach.
Two more low-level approaches are:
An HTTP/HTML based interface.
Using the X protocol to talk directly with an X server.
Both of these approaches can be used with Ada, and probably also with Python. I don't know for sure if Python can do the necessary low-level formatting to talk with an X server, but it must be possible somehow.
If you're looking to use Python, try out PySimpleGUI. There are objects in use, but you don't have to do any object programming. You can copy and paste the "design patterns" without having to know exactly what they do. It was developed with beginners in mind, but can also support advanced, customized window layouts. Look at the Cookbook for code examples. You mostly need to learn how to do a "layout". You will not have to write the word "class" in your code, promise.

Elixir for Data Science [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I recently started playing with Elixir and some patterns remind me of Python, which is widely used in data science projects. For example list comprehensions or anonymous functions.
Considering the high performance of Elixir and the ability to run multiple processes and deal with asynchronous tasks it seams to me to be a very good fit for Data Science projects.
Am I missing a point? Does somebody have experience with this?
I'm an advocate for using the right tool for the job. There are typically two requirements to do data science:
Libraries (because you don't want to reinvent the wheel at every corner)
Performance (particularly if dealing with large amounts of data)
Python and R are the right tools. They offer the largest number of high-quality libraries, and though slow on their own, they perform well thanks to libraries written and optimized in fast languages like C and Fortran.
Some like alternatives like Julia and Scala. These are faster languages on their own and have a decent amount of libraries, though you might still run into some situations where suitable libraries are available in Python or R, but not Julia or Scala.
With languages like Elixir, you're are for the most part on your own. The amount of data science specific libraries is limited, and the Elixir community - though wonderful - is mostly focused on distributed computing and web development, so don't count on lots of support there.
In short, can you? Technically yes, and there is no harm in experimenting, but you're making your life significantly harder.
Keep also in mind that, contrary to popular belief, Elixir is not a fast language when it comes to single-thread performance. Depending on the task at hand, you'll find that Ruby is just as fast or even faster in some instances.
Don't get me wrong, Elixir is a great language and it's amazing at what it does best, it's just that it's not the kind of language I'd reach out to first for mathematical computations.
Data Science is very broad topic there many things involved, I would like to add my 2 cents you sure can do data science in elixir but it may not do certain things very well like some of the other tools do, but you can get pretty far I use elixir for data cleaning and data formatting.
There are other folks that are doing data related stuff with elixir/erlang
https://moz.com/devblog/moz-analytics-db-free/ and there is disco that allows you run MapReduce jobs in erlang
https://github.com/discoproject/disco

why do people say that RPython is an unpleasant language to program in [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
It is often stated that RPython is an unpleasant language to program in, for example, here, here, here or here.
However, for example here in the original paper about RPython, it says quite the opposite:
The result is a language that is more expressive than C# and Java, but
which does not compromise runtime efficiency. RPython was initially
designed for the specific purpose of implementing PyPy [25] (a Python
interpreter written in Python), but it has grown into a full-fledged
language in its own right.
Currently, RPython can be used in many contexts: to develop
stand-alone programs, such as the Standard Interpreter itself; to
write highly efficient extension modules for CPython, which could only
be written in C in the past; to develop dynamic web applications
without the need to write JavaScript code; to produce efficient
libraries of classes and functions to be used by other .NET and Java
programs. In particular, RPython can be the ideal companion for all
those CPython, IronPython and Jython developers that so far have been
forced to write the parts of their programs that need high performance
in C, C# or Java.
A related question for using RPython as a general purpose language is also here. I was also wondering about using RPython as a replacement for Cython. A related question is here. There is also the RPythonic project.
Why is it that people recommend against using RPython?
from here:https://mail.python.org/pipermail/pypy-dev/2013-June/011503.html
"
When people look at RPython, an obvious feature is that it is
syntactically identical to Python. "RPython must be an easy language,
given that it has got the syntax of Python, which is easy". This is a
common misconception. In fact, pleasing the automatic type inference
process can be difficult. It requires the programmer keeping in his
head the global types of his whole program, and carefully writing code
according to these implicit types. The process is much harder for
newcomers, which don't have any written-down example to learn how to
manipulate the types --- precisely because they are implicit.
"
I have made one file conversion program using RPython toolchain. Simple buffered file input and output. I can't imagine with my skills easier language to make such a fast, reliable, low bugs program.
What works and what doesn't is not well documented but once you find things out it is really nice set of tools to make small, fast and reliable programs.

Python TUI libs [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
The community reviewed whether to reopen this question 7 months ago and left it closed:
Opinion-based Update the question so it can be answered with facts and citations by editing this post.
Improve this question
I'm writing a small sudoku game/solver in Linux using python with TUI (not GUI, that's just lame) just for fun. My question is, which lib is better (by that I mean easier to handle, better support, more straight-forward and understandable), the choices are curses or urwid or if anyone have better suggention, and why? I have some Tkinter and wxPython experiences.
Any help or information will be appreciated.
You might want to check out Unicurses, which wraps the python core curses module in UNIX systems and wraps the free pdcurses library on windows-based machines.
This library is designed to emulate the syntax and style of the original ncurses library, so if you're interested in learning TUI design using curses-style programming, then check it out.
Urwid is, from what little documentation I've read, a very interesting library which uses event loops (the reactor pattern) as a basis for application design, much like tkinter or Twisted. Also, urwid has an event loop class specifically designed for use with Twisted, so if your aim is to created TUIs for use over networks, its a good choice. Twisted also uses the reactor pattern, so if you want to learn that style, I'd recommend it.
Finally, if you do go with an ncurses-style library, check out Dan Gookin's book on ncurses. A very good resource, and the only one I know of which is in print today.
There are other options such as newt, pygcurses, and so on, but this should get you started. Best of luck, TUI programming today is one of those technological fetishes that can be hard to break into, but it's rewarding.
While the above is a perfectly reasonable solution for Linux, The OP asked for other suggestions and a justification for them.
Who wants to use a low level API like curses in a modern OO language like Python? Let alone if you are stuck inside Windows (which the OP isn't, but is a problem for a lot of people out there)... There must be a better way.
To try to resolve this, I have put together a simple cross platform class (yup - Windows is included without falling back to PDcurses) to do all the things most people want from their terminal/console. If you're on Linux this is a more human way to program curses. If you're on Windows, the same class works as is with no external binary dependencies. You can find the Screen class in asciimatics.
In addition, I've created a load of highr level objects to create animations and TUIs. For example, this is a recording of a sample using the TUI widgets:
If there's an extra feature you need, let me know and I'll see what I can do.
If your game will run inside a console, then just pick curses.
If your game will run as a GUI application, then just pick PySide.

Categories