Why Python 3 Is the Python You Always Wanted
If you love using Python for big data, but you are on the fence about moving to Python 3, then you need to have a look at this post.
Join the DZone community and get the full member experience.Join For Free
Back when Python was just an idea in Guido van Rossum’s mind, the World Wide Web was just being born, APIs were proprietary (if your application had one at all), and everyone was doing scripting in a brand new language called Perl.
Much has changed since then, including the Python language your dad or mom may have used.
Technological change occurs at an exponential rate. The most commonly cited example of this is Moore’s Law for hardware; but the law is just as true for software as it is for hardware. Unfortunately, with hardware, you end up with a drawer full of old, obsolete cell phones. With software, sometimes the concepts on which the original version were built have changed so drastically that you can no longer just upgrade it with the push of a button.
Unicode and Multilingual Support
This is exactly what happened shortly after the release of Python 2 in 2000 when the Unicode specification was finalized. This spec, combined with the way
string was implemented, crippled Python 2’s ability to support multilingual applications. While the Python community has come up with multiple workarounds, Python 3 was created to provide the definitive solution.
Python 3 has more going for it than just being a Python 2 replacement (note that Python 2 has been issued an expiry date of January 1, 2020). Python 3 is a much cleaner and superior language version all around because:
- Python 3 makes coding more obvious and intuitive by removing duplicate constructs and modules.
- Python 3 simplifies multilingual support, with its core
stringtype based on Unicode by default.
- Python 3 makes it easier to swap in any print function, now that
- Python 3’s integer division now automatically promotes to a floating point result.
The Path Forward
Python 3 is now the dominant version of Python, having surpassed Python 2 in 2017, and continues to gain momentum with every release by adding key features such as:
- Cross-platform support for extensions, so new modules built on one OS can be shared with users on other OSs.
- Cross-platform bootstrapping of the pip command ensures third-party packages and their dependencies can always be installed properly.
- Support for virtual environments enables multiple installs of Python on the same system and thereby simplifying things like testing on Python 2 vs 3.
- And many more!
All these new features come at the cost of forfeiting push-button upgradability between Python 2 and 3. While there are a number of solutions that can help with code migration, all of them will require work to implement.
Published at DZone with permission of Dana Crane, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.