What is python?
Python is a dynamic typed interpreted programming language whose philosophy emphasizes syntax that favors readable code. It is a multi-paradigm programming language and available on various platforms.
In other words, Python presents the following characteristics:
- Interpreted Language: It runs without the need to be processed by the compiler and errors are detected at runtime. It executes the code line by line at a time. When you use an interpreted language like Python, there is no separate compilation and execution steps. You just run the program from the source code. This makes debugging easy and thus suitable for beginners. Internally, Python converts the source code into an intermediate form called bytecodes and then translates this into the native language of your specific computer and then runs it. You just run your programs and you never have to worry about linking and loading with libraries, etc.
- Multi-paradigm Language: Supports functional programming, imperative programming and object-oriented programming.
- Dynamic typing: Variables are checked at runtime.
- Multiplatform Language: available for Windows, Linux or MAC platforms.
- Free: No license to program.
By making use of a readable syntax, the learning curve is very fast, making it one of the best languages to start programming in text mode.
For example, if we compare code written in block programming language like Blockly and write the same code using Python, we see the similarities in the instructions.
Python contains a large number of libraries, data types, and functions built into the language itself, which help you perform many common tasks without having to program them from scratch. But what really makes it brilliant using it on a Raspberry Pi is the ability to use GPIO pins to connect the physical world to the digital world.
Advantages of Python
- Python is a Beginner's Language
For a Beginner who has never programmed before, using a statically typed language seems unnatural. It presents additional complexity that the beginner must master and slows the pace of the course. With Python , a beginner can quickly introduced to basic concepts such as loops and procedures. They can even probably work with user-defined objects in their very first course. Python's extreme syntactical simplicity , it allows for a beginner to utilise basic or advanced programming concepts, without much "boiler-plate" code like most other languages, for example to display output in screen is one line compared to most other languages requiring a lot more 'setup'.
- Simple and Easy to Learn
Python is extremely easy to get started with. It offers an easy to understand syntax, simple setup, and has many practical applications in web development. The syntax isn't too annoying compared to other languages, and you can import a bunch of modules which can often make your code much shorter. There are excellent, straightforward tools to work with python code, especially the interactive interpreter ; you don't need to learn a build system, IDE, special text editor, or anything else to start using python. All you need only a command prompt and the interactive editor.
- Cross-platform language
Python can run equally on different platforms such as Windows, Linux, Unix , Macintosh etc. A Python program written on a Macintosh computer will run on a Linux system and vice versa. Thus, Python is a portable language .
- Free and Open Source
Python is an example of a FLOSS (Free/Libre and Open Source Software). In simple terms, you can freely distribute copies of this software, read the software's source code, make changes to it, use pieces of it in new free programs , and that you know you can do these things. Python language is freely available at www.python.org . The source-code is also available. Therefore it is open source.
- Object-Oriented language
Python supports object oriented features. Compared with other programming languages, Python's class mechanism adds classes with a minimum of new syntax and semantics. It is a mixture of the class mechanisms found in C++ and Modula-3 . Python classes provide all the standard features of Object Oriented Programming Language except strong encapsulation , which is only one of many features associated with the term "object-oriented".
- Extensive Libraries
The Python Standard Library is huge indeed. Python library contains built-in modules (written in C) that provide access to system functionality such as file I/O that would otherwise be inaccessible to Python programmers , as well as modules written in Python that provide standardized solutions for many problems that occur in everyday programming. It can help you do various things involving regular expressions, documentation generation, unit testing, threading , databases etc.
Python can be easily integrated with languages like C, C++, JAVA etc.
- Databases Connectivity
Python provides interface to all commercial databases.
Disadvantages of Python
Python is slower than C or C++. But of course, Python is a high-level language, unlike C or C++ it's not closer to hardware.
- Mobile Development
Python is not a very good language for mobile development . It is seen as a weak language for mobile computing. This is the reason very few mobile applications are built in it like Carbonnelle.
- Memory Consumption
Python is not a good choice for memory intensive tasks. Due to the flexibility of the data-types, Python's memory consumption is also high.
- Database Access
Python has limitations with database access . As compared to the popular technologies like JDBC and ODBC, the Python's database access layer is found to be bit underdeveloped and primitive . However, it cannot be applied in the enterprises that need smooth interaction of complex legacy data .
- Runtime Errors
Python programmers 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.
Is it a good thing?
Yes, very much so. While generally what is popular isn't always the best, in the case of programming languages the popularity pays off.
Thanks to Python's popularity, you're likely to find a ready-made solution to any problem you may be experiencing. The community of Python enthusiasts is strong and they are working tirelessly on improving the language every day.
Python also has a number of corporate sponsors, pushing to popularize the language further still. Among them are tech giants such as Google, which itself is using Python.
Python in Biomedical Engineering
This is where I give my personal opinion about Python. As you might know if you have read the About me section , right now I am working on artificial intelligence so I am using python, which in this case is from far the best tool for machine learning.
- Why? Taking into consideration the advantages of python and the aim of Machine Learning, that you can read here, Python is the best option because it is very easy to understand. they take the maximum amount of effort. Sometimes the concepts of Linear Algebra, Calculus are so complex , that they take the maximum amount of effort. A quick implementation in Python helps a ML engineer to validate an idea. and the wide amount of packages simplifies the task.
- What other fields of Biomedical Enigneering do we use Python for? Python , as I explained, is good for general purpose scripting language, and therefore you can apply it to whatever general code you need, but highly recommended for Big Data management. I think it is a language you should foccus on, as well as Matlab, which is very useful. However, for some specific fields, such as robotics, I personally preconize Arduino, particularlay for haptic devics, but it depends on the project. We will talk about it in further articles.
Quotes on Python
As it seems to me, in Perl you have to be an expert to correctly make a nested data structure like, say, a list of hashes of instances. In Python, you have to be an idiot not to be able to do it, because you just write it down.
- Peter Norvig
The joy of coding Python should be in seeing short, concise, readable classes that express a lot of action in a small amount of clear code -- not in reams of trivial code that bores the reader to death.
- Guido van Rossum
My favorite language for maintainability is Python. It has simple, clean syntax, object encapsulation, good library support, and optional named parameters.
- Bram Cohen