What is Python?
Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together.
Difference Between Scripting and Compiled Languages
- Languages that are needs to be compiled are compiled languages Ex: C, C++, Java
- Scripting language can have a big performance problem. Translating on the fly can affect the application’s performance.
- Typically, the pre compiled code is faster than on the fly translating.
- It’s worth noting that languages are not only interpreted or compiled.
Comparisons with other Languages
- Java Script
- Python is slower than Java in general.
- Development period is way shorter than Java.
- In general, Python code is 3-5 times shorter. The reason for this: Python is more advanced and Dynamic Data Type in Python. Ex: variables.
- Because of the run-time typing, Python’s run-time must work harder than Java’s
- For example, when evaluating the expression a+b, it must first inspect the objects a and b to find out their type, which is not known at compile time. It then invokes the appropriate addition operation, which may be an overloaded user-defined method. Java, on the other hand, can perform an efficient integer or floating point addition, but requires variable declarations for a and b, and does not allow overloading of the + operator for instances of user-defined classes.
- For this reasons Python is more like a “glue language”.
- On the other hand, Java is a low level implementation language. So they are perfect couple together.
- Ex: Components can be developed in Java and combined to form applications in Python. Python can also be used to prototype components until their design can be “hardened” in a Java implementation
- Python supports writing much larger programs and better code reuse through a true object-oriented programming style, where classes and inheritance play an important role.
- Python and Perl come from a similar background (Unix scripting).
- Many similar features, but have a different philosophy.
- Perl emphasizes support for common application-oriented tasks, e.g. by having built-in regular expressions, file scanning and report generating features.
- Python emphasizes support for common programming methodologies such as data structure design and object-oriented programming, and encourages programmers to write readable (and thus maintainable) code by providing an elegant but not overly cryptic notation.
- As a consequence, Python comes close to Perl but rarely beats it in its original application domain; however Python has an applicability well beyond Perl’s niche.
- Almost everything said for Java also applies for C++, just more so: where Python code is typically 3-5 times shorter than equivalent Java code, it is often 5-10 times shorter than equivalent C++ code.
- Anecdotal evidence suggests that one Python programmer can finish in two months what two C++ programmers can’t complete in a year. Python shines as a glue language, used to combine components written in C++.
- https://benchmarksgame-team.pages.debian.net/ benchmarksgame/faster/python.html
- Energy efficiency isn’t just a hardware problem. Your programming language choices can have serious effects on the efficiency of your energy consumption.
What exactly can I use Python for?
- There are three main popular applications for Python:
- – Web Development.
- – Data Science – including machine learning, data analysis, and data visualization.
- – Scripting.
- Web frameworks that are based on Python like Django and Flask have recently become very popular for web development.
- These web frameworks help you create server-side code (backend code) in Python.
Data Science – Machine Learning
- Two of the most popular python libraries are scikit-learn and TensorFlow.
- – scikit-learn comes with some of the more popular machine learning algorithms built-in. (For beginners)
- – TensorFlow is more of a low-level library that allows you to build custom machine learning algorithms. (For more efficiency)
Data Science – Visualization
- One of the most popular libraries for data visualization is Matplotlib.
- Scripting usually refers to writing small programs that are designed to automate simple tasks.
What about embedded applications, desktop applications or gaming ?
- You can use python on Rasberry Pi. Performance: Average.
- You could use the library called PyGame to develop games, but it’s not the most popular gaming engine out there. You could use it to build a hobby project.
- You could make one with Python using Tkinter, but it doesn’t seem like the most popular choice either. Instead, it seems like languages like Java, C#, and C++ are more popular for this.
So, what is the strongest side of python ?
- My personal thought is rapid web development.
- Frameworks such as Django and Pyramid. • Micro frameworks such as Flask and bottle.
- Advanced content management systems such as Plone and django CMS.
- Python’s standard libraries supports many internet protocols. (HTML, XML, JSON, E-mail processing, easy-to-use socket interface …)
- However for backend development Java also should be considered:
- Short Term, Easy, Understanding : Python
- Long Term, Fast, Scalable : Java