As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
We think about whether we should convert a quite large python web application to Python 3 in the near future.
All experiences, possible challenges or guidelines are highly appreciated.
My suggestion is that you stick with Python 2.6+, but simply add the -3 flag to warn you about incompatibilities with Python 3.0. Then you can make sure your Python 2.6 can be easily upgraded to Python 3.0 via 2to3, without actually making that jump quite yet. I would suggest you hold back at the moment, because you may at some point want to use a library and find out that it is only available for 2.6 and not 3.0; if you make sure to cleanup things flagged by -3, then you will be easily able to make the jump, but you will also be able to take advantage of the code that is only available for 2.6+ and which is not yet ready for 3.0.
For each third-party library that you use, make sure it has Python 3 support. A lot of the major Python libraries are migrated to 3 now. Check the docs and mailing lists for the libraries.
When all the libraries you depend on are supported, I suggest you go for it.
Related
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm working on an open source project (Master of Mana, a mod for Civilization 4) which uses Python 2.4.1 for several game mechanics. Is there a chance for a performance improvement if I try to upgrade to Python 2.7.3 or even 3.3.0?
Related to this, has anyone done a performance analysis on different Python versions?
Most newer Python versions bring new features.
Existing code parts are probably updated as well, either for performance or for extended functionality.
The former kind of changes bring a performance benefit, but extended functionality might lead to a poorer performance.
I don't know what is the relationship between these kinds of changes. Probably you will have to do some profiling on yourself.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I've looked around for answers and much seems to be old or outdated. Has Python 3 been updated yet so that it's decently faster than Python 2.7 or am I still better off sticking with my workable code?
The issue isn't about speed -- they're either the same speed or Python 3.x is faster (depending on which benchmarks you look at). More specifically, Python 2 used to be faster, but apparently, they're on par with each other now (?). See the comments and this slide deck (towards the back).
The core devs are also actively working on optimizing Python 3 -- each new release of Python 3 has been faster than the last. You can keep abreast of the latest proposals and ideas on optimizing Python (as well as the many complications) by monitoring the python-dev mailing list.
Rather, the reason many people used to give for not updated is because when Python 3 came out, and for several years after, the majority of Python libraries were not updated to work on Python 3.x. However, thankfully, this situation is vastly improved today -- the majority of 3rd party libraries are now Python 3 compatible.
The Python FAQ contains more info. You can also check the Python Wall of Superpowers or Py3 Readiness to get an overview of which popular Python libraries are currently compatible with Python 3.
Update: (Summer 2017)
I feel somewhat obligated to note that support for Python 2 is formally ending in 2020.
Many 3rd party libraries are also planning on following suit -- a large subset of the scientific ecosystem (e.g. matplotlib, pandas, ipython) are planning on dropping support for Python 2 in 2020, Django is dropping support... I wouldn't be surprised if other libraries do the same.
So, if you're interested in making sure you can use the latest and greatest features in either Python or your favorite library, you should look into migrating to Python 3 sooner rather than later.
Here are some guides on converting Python 2 to 3 code:
https://docs.python.org/3/howto/pyporting.html
http://python3porting.com/
https://eev.ee/blog/2016/07/31/python-faq-how-do-i-port-to-python-3/
FYI, here's a performance benchmark comparing Python 2.7 with Python 3.3. Python 3.3 comes faster than Python 2.7.
Python 3.3 included an optimization for Unicode strings that reduced their memory consumption. That might translate into faster code if more of it fits into cache.
Really the only way to know is to benchmark your most critical code in both and see what the difference is.
The necessity of Libraries for your applications will determine whether Python3 or Pyhton2 is better.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm attempting to convert a Python application I coded using the cmd module into a gui. Initially, I came across EasyGui. But after giving it a try, I find that it is very limited, the gui screens are not consistent, and overall not easy on the eyes. I read about IronPython (Python + .NET), but cannot find adequate documentation on it. Before I order a book from Amazon on IronPython (as this seems the most legitimate), does anyone know of a decent gui alternative for Python? Thanks!
Tkinter is in the standard library, works on all platforms, and is fairly simple and lightweight, but it looks a bit clunky.
WxPython tries to use platform widgets, so it looks a bit better, but it's a separate library. On Linux, I still find it doesn't look quite right.
PyQt is a large, powerful framework - it looks good, and you can do a lot with it, but it's more complex and a larger install.
There are plenty of others, but those are probably the most popular.
I've used libglade before to write GUIs in Python. I thought the results felt very native (as native as any GUI toolkit can under Linux), and using it was a lot like every other GUI toolkit I've used.
The best GUI's for Python are tkinter, Qt (PyQt), and wx (wxPython). Search any of those terms to learn more.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Although this question is very popular here in StackOverflow, after spending some time here and in the Google, I still haven't find a concrete answer on what is the most appropriate way to do SOAP consuming in Python 3.
I took a look at Does a Python 3 SOAP client module exist?, and I hope it is outdated and today some solution to this may have appeared.
I was thinking about some ideas:
Use 2to3 script to port some existing libraries to Python 3 (SOAPy, suds, etc).
Load an external module, by mixing technologies (Py3k + Jython, Py3k + Python 2.6, etc.)
Write in hardcode Python classes that corresponds to definitions of WSDL files (which implies in tight-coupling/high maintenance).
Write the software in Python 3.0, call the "python2.6-only" module functions through the execnet package. Which requires the Python 2.6 to be installed on the machine and the software written in Python3.0 to be a frozen binary.
Any ideas?
Thanks in advance
I would probably start by trying your suggested 2to3 port. For many things, it works pretty well. It would still be a day or two worth of work to convert something like suds, I imagine.
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am extremely new to python, having started to learn it less than a month ago, but experienced with some other programming languages (primarily C# and SQL). But now that Python 3.0 has been released and is not backwards compatible, what would be the advantages and disadvantages of deciding to focus on Python 3.0 or Python 2.6?
Go with 2.6 since that's what most libraries(pygame, wxpython, django, etc) target.
The differences in 3.0 aren't that huge, so transitioning to it later shouldn't be much of a problem.
Since they have incompatibilities, I suggest you start going for Python 3.0 which is more useful in the future anyway. It's a better language. You can see the precise differences in What's new page on its Web site.
I would say begin with 2.6 since the vast, vast majority of documentation regarding Python will be applicable to 2.6 as well most open source projects you may want to contribute to will be in 2.6 for awhile. Then, once you have a good foundation in 2.6, you can learn 3.0. That way you can kind of appreciate how the language has evolved and where the "aesthetic" of the code comes from.
Start with 2.6, and when you get a bit more proficient with the language (few thousands of lines of code written), transitioning to 3.0 will be easy and natural. While learning I suggest you ignore classic classes, and pay special attention to iterators, generators, and list comprehension.
It depends on what you are willing to do.
Python 3.0 is the newer release, and with time should become the standard.
However, it has almost no libraries or frameworks available, and even the tools are not so up to date (e.g. the Eclipse plug-in for Python is still in the migration phase).
On the other hand, there are no huge differences, and once you learn one, moving to the other is quite easy.
So, if you plan just to play around, you can go with 3.0.
If you plan to use it on a new project, I would stick on an older release.
Be careful though. Libraries such as the mysql driver are still in 2.5
If you're looking at it from a getting-a-job perspective, I'd definitely at least learn 2.x as well. The code I work on is still targeting python 2.4 and to the best of my knowledge there is no plans to move to even 2.6, let alone 3.0 in the near future. There will be a ton of 2.x python code floating around for years to come and the vast majority of python jobs will involve working with that code.
So I'd start by learning python 2.6 while the whole time keeping an eye on 3.0 so that you are at least aware of what bits of your 2.x code won't work in 3.0