Tuesday, December 1, 2020

Daniel Bader: What Can You Do With Python?

What Can You Do With Python?

(short blurb)

According to StackOverflow, Python “has a solid claim to being the fastest growing major programming language in the world.”. It is clearly a good time to be a Python developer, as more and more fields are finding Python more useful than ever before. This is not surprising at all, as Python is simple, clear and easy to learn, making it useful in fields outside of Computer Science. The thriving Python ecosystem and its flexibility have made it an incredibly extensible language which you can apply in any field. If there’s something you need to do in Python, there’s probably a framework for it.

So whether you’re a new learner looking for inspiration or an advanced developer checking Python out, here’s what Python is (mostly) being used for these days.

Apps and Games

While an “app” is a very broad term, for the most part, we’re referring to apps as you would see on a mobile phone. While Python is not the language of choice for mobile programming right now, it’s not impossible to use it to make mobile apps. The main challenge with mobile apps is to create an intuitive and easy to use interface that makes good use of touch. Multi-platform frameworks like Kivy allow you to focus on making your UI and UX design as neat and effective as possible and make the code simpler. Kivy can be used to make Android and iOS apps with Python, and even use those apps on your PC as well.

If you want to make a more traditional Windows or Linux applications instead, you can use one of many GUI Frameworks such as PyGTK to write cross-platform GUI applications. Calibre, a widely used desktop app used to organise, manage and read ebooks, is coded largely in Python. Python’s multi-platform nature makes it easy to write code that can be easily used on computers running different operating systems and architectures, and you can spend your time working on program logic instead of porting your program everywhere it needs to be.

The aforementioned Kivy framework can also be used to write video games as well, but the real king in this field (at least for Python) is PyGame. PyGame is a popular framework that can be used to create 2D and 3D games, and there are many, many libraries built to extend PyGame and make complicated games. PyGame is an easy way to understand the basics of game design without being bogged down by the boilerplate code making games is known for. However, for the most part, if you’re looking to write an app or a game, you might be better off not using Python at all.

On the Web

Python has for some time now been a big player in the field of server-side languages. The frameworks Django and Pylons are popular choices to write server programs that generate HTML pages and manage the data models and databases that the website needs. Django, a framework for “perfectionists with deadlines”, is also very fast to learn and deploy.

Both Django and Pylons can be used for full-scale websites and serious workloads. The popular website Reddit (which ranks 8th on Alexa’s worldwide ranking at the time of writing) uses Pylons and serves millions of users every day. Another Python (micro) framework known as Flask is used in popular websites like Pinterest and LinkedIn, and interest in it has been growing over time.

Prominent web companies, foremost among them Google, have been very enthusiastic in using Python. Guido van Rossum, the creator of Python, worked for Google, and the company today lists Python as one of the three official languages they use. Python is seeing greater use in the enterprise scene overall, as its flexibility and ease of use make it easy for rapid prototyping and proof of concepts.

Machine Learning and Scientific Computing

But the scene where Python has made the biggest impact, and in the process grown the most is that of Machine Learning. Machine Learning is the technique of making computers “learn” to perform complicated tasks such as reading text within images, predicting fluctuations in the economy, drive cars without human intervention or even write music. It’s a cutting-edge field that has been growing rapidly as it holds the potential to transform many industries entirely.

Machine Learning requires handling large swathes of data and performing many complicated calculations on them especially matrix multiplications, which are computationally very expensive. While languages like C++ may be faster than Python, Python is incredibly easy to pick up for people who don’t need more than a passing knowledge of programming and want to focus on the mathematics of Machine Learning instead. Python also makes reading and writing data easy to do without any hassle, unlike most other languages, and libraries like numpy have made performing highly optimised numeric calculations in Python simple.

Python’s rising popularity in Machine Learning is also due to the thriving Machine Learning community that uses Python and the availability of many Machine Learning frameworks. Pandas is a data analysis framework for Python and is one of the most used frameworks in Python. With a standard library like numpy that makes it possible to perform MATLAB-like calculations in python and a framework like Pandas that allows you to handle and analyse data quickly, you have all the benefits of domain-specific languages like MATLAB and R without having to give up on the flexibility and interoperability of Python.

Scientific computing is a field that uses the fast computational capabilities of computers to solve complex problems in science. Cutting edge fields like Computational Fluid Dynamics and widely used software in simulation are examples of usage in scientific computing. For a long time, MATLAB was the most popular language in this field, but its proprietary nature and limited scope makes it a less useful language overall. Python, on the other hand, is extensible, easy to learn and use and interoperable with many other frameworks and languages. Python has been used to detect exoplanets in planetary systems far from Earth, and as the need for computing in science grows so will Python.

Machine Learning, Data Science and Scientific Computing are thriving fields, and no one language completely rules the roost here. However, if you don’t want to restrict yourself to these fields and leave the window open to get into other dimensions of computing, Python is the more obvious choice.

Power User

Perhaps the most interesting and fun aspect of Python for day to day use is the ability to quickly write scripts to automate boring, repetitive tasks. The hit book “Automate the Boring Stuff” uses to Python to teach people to make the most out of their computers by doing things like renaming batches of files, crawling through the internet and downloading files, resizing images and so on.

The best part about using Python to write such scripts is that it’s easy to read and write. Instead of thinking about how your algorithm will turn into code, Python’s simplicity makes it easy for the focus to be on program logic instead of the arcane specifics of the language. Linux users who are proficient with shell scripting can synergise with Python to make incredibly powerful routines that can make computing a breeze.

In this field, too, there are many libraries and frameworks that make Python the optimum choice. Beautiful Soup can help you parse HTML and get what you need out of a webpage without having to read it, so you can build a script to, say, get your grade from your school’s website automatically without having to open the page. Beautiful Soup and other such frameworks can also be used to write programs as complicated as search engines.

Conclusion

As with any other language, Python does what you want it to do. However, the nature of Python makes it uniquely suitable for the things we’ve seen - rapid prototyping, extensibility, and quick automation. While you think about this list and what Python is used for, don’t limit yourself to this - if you think you can make use of Python in an interesting way elsewhere, by all means, do so. Who knows, maybe ten years down the line, we’ll be talking about what you did with Python?


[ Improve Your Python with Dan's 🐍 Python Tricks 💌 – Get a short & sweet Python Trick delivered to your inbox every couple of days. >> Click here to learn more and see examples ]



from Planet Python
via read more

No comments:

Post a Comment

TestDriven.io: Working with Static and Media Files in Django

This article looks at how to work with static and media files in a Django project, locally and in production. from Planet Python via read...