Skip to main content

A Developers Guide To The Pros And Cons Of Python

From: Techgig.com

Python is billed by the Python Software Foundation as being easy to learn and running everywhere. It's useful for a range of application types, including Web development, scientific computing, and education. Google and Instagram have been among the many users of Python, and the language scores well in popularity indexes.

But Python has had its issues, with questions raised about its performance and design quirks. To get to the bottom of what's right -- and maybe not so right -- about Python, InfoWorld Editor at Large Paul Krill asked dignitaries in the Python community for their input.

Python pros

Read it, use it with ease. "The main characteristics of a Python program is that it is easy to read," says Pierre Carbonnelle, a Python programmer and blogger who runs the PyPL language index. "This has benefits to you and to others. It helps you think more clearly when writing programs, and it helps the others who will maintain or enhance your program. In both cases, it requires less effort to write a Python program than to write one in another language like C++ or Java." Readability of Python facilitates open source development, Carbonnelle added.

Python is easy to use and extremely popular in academia, creating a large talent pool, says Sumit Chachra, CTO at Tivix, a software consulting firm that specializes in Python/Django development. Django and Python are leveraged by Tivix in Web and mobile development, he says.

Python is a very productive way to write code, says Stephen Deibel, of Wingware, which makes the Wing Python IDE. "Some of this comes from the simple syntax and readability -- there is virtually no 'boilerplate' at all. Some of it comes from the rich, well-designed built-ins and standard library and the availability of many third-party open source libraries and modules." By being easy to understand, the code is easier to maintain, he adds.

Python, says Chachra, is dynamically typed and flexible, with code that is less verbose. However, he cites dynamic typing as a potential negative (see below).

Internet of things opportunities. Python may become popular for the Internet of things, as new platforms such as Raspberry Pi are based on it, Carbonnelle says. Raspberry Pi's documentation cites the language as "a wonderful and powerful programming language that's easy to use (easy to read and write) and with Raspberry Pi lets you connect your project to the real world."

Asynchronous coding benefits. Python, Deibel says, "is great for writing asynchronous code, which rather than threading uses a single event loop to do work in small units." This code, he says, is often easier to write and maintain without confusing resource contention, deadlocks, etc. "Python's generators are a great way to interleave running many processing loops in this approach."

Multiparadigm approach bests Java. Python's programming approach is not as limited as Java's, Carbonnelle says. "For example, you don't need to create an OO class to print 'Hello world' in Python -- you have to in Java." Unlike Java, Python is multiparadigm and supports OO, procedural, and functional programming styles, he says. (Java recently added functional capabilities in Java 8.)

"In Python, everything is an object," says Brian Curtin, a member of the Python Software Foundation board of directors and a core contributor to CPython. "It's possible to write applications in Python using several programming paradigms, but it does make for writing very clear and understandable object-oriented code."

Python's cons

Speed can be an issue. "Because it is an interpreted language, it is often many times slower than compiled languages," Curtin says. "However, it comes back to separating the language from the runtime. Certain benchmarks of Python code run under PyPy run faster than the equivalent C code or others."

"A possible disadvantage of Python is its slow speed of execution," says Carbonnelle. But many Python packages have been optimized over the years and execute at C speed, he says. Performance, Chachra says, "is slower compared to older languages such as C/C++ and even newer ones such as Go." Absence from mobile computing and browsers. "Python is present on many server and desktop platforms, but it is weak in mobile computing; very few smartphone applications are developed with Python," says Carbonnelle. "It is also rarely seen on the client side of a Web application."

Python isn't in Web browsers, Deibel notes. "That's a real shame. There is brython, but I don't think it's real-world usable." Python is hard to secure, and that's why it is not in browsers, he adds. "There still isn't really a good secure sandbox/jail for Python, and I think it's considered basically impossible for CPython (the standard implementation).

Design restrictions. Python devotees cited several issues with the design of the language. Because the language is dynamically typed, it requires more testing and has errors that only show up at runtime, Chachra says.

Python's global interpreter lock, meanwhile, means only one thread can access Python internals at a time, Deibel says. "This may be less important these days, since you can so easily spawn tasks out to separate processes using the multiprocessing module, or write asynchronous code instead."

Curtin says there are a few conventions around the use of Python, but significant whitespace is one that is enforced by the interpreter. "The structure of Python programs must be consistent, so where brackets or other identifiers allow the user more freedom in other languages, indentation is what matters when it comes to Python."


Comments

Popular posts from this blog

10 Free Online Courses That Can Benefit Every Entrepreneur

Read more at: Techgig.com Every entrepreneur can benefit from continued education. Whether you are just starting out and handling multiple roles within your company or an experienced business owner -- enrolling in an online course is always a good way to improve your knowledge and has never been easier or more affordable. Long gone are the days of taking evening classes at local colleges and paying tuition. You can now take excellent courses in the comfort of your own home for free. Here are ten free online courses that every entrepreneur can benefit from. 1. 21 Critical Lessons for Entrepreneurs This two-hour video course by Docstoc CEO Jason Nazar takes his real-world experience and breaks it into several video lessons that discuss all the important steps of running a successful business, from vetting an idea and raising money from investors to scaling and growth strategies. There are a lot of coaching and training programs online that are put together by individ

Microsoft Ends Support for Windows 10 Version 1803, Users Advised to Update Now to Get New Features

Microsoft has announced that the company will no provide updates to PCs running Windows 10 version 1809 (aka October 2018 Update) as it will no longer support the outdated operating system. Originally, support for the Windows 10 version 1809 was supposed to end early this year; however, it was delayed to the COVID-19 pandemic, therefore giving more time to users and IT professional to update their systems. As a result, users with Windows 10 Home or Pro editions of Windows 10 version 1809 will not receive monthly security and quality updates containing protections from the latest security threats. To update to latest Windows OS, users can head to Settings > Update & Security > Windows Update. Although several users are likely using the Windows 10 version 1909 as Microsoft started rolling out the automatic update last December, the newer version might be unavailable to those who turned off automatic updates. Typically, Microsoft brings new features for Windows 10 versions fo

Home Automation for Masses - Easy Inexpensive and Integrated with Amazon Alex and Google Home. Works Without Internet too Just use your remote.

Home Automation