Python Facts (Hard vs Easy, Bad vs Good, Hated vs Loved)


Python is an increasingly popular programming language used in business as well as across schools. Particularly respected for it’s wide ranging functionality from scientific, research to number crunching ability.

So, is python hard? Generally speaking python is not a hard programming language as it is considered to be a high level language, where an interpreter takes the python code and converts it into low-level computer code that the operating system can understand and run.

High-level languages like Python are designed to provide an abstraction layer between the operating system and the programmer, making it easier to code without having to get into low-level programming that the operating system like Microsoft Windows tend to understand.

Low level languages where management of memory, use of pointers to garbage collection require a deep knowledge. Python on the other hand, takes care of this in the background, leaving the programmer to concentrate on the coding itself.

Python’s syntax makes it an ideal language to learn quickly and this is one of the reasons why it is so widely taught to school children. With many schools now focused on providing their students with coding experience, Python has quickly become the most popular way of doing this.

The syntax of Python allows children to remain focused on learning and not lose motivation which is what could happen with a more difficult language like C++. Python through it’s many libraries makes it easier to be able to use python for a number of purposes.

For example, the machine learning libraries allow programmers to use simple Python programming to undertake complex data modelling and data analytic tasks. Which using a low level programming language would require extensive knowledge and programming skills, that would undoubtedly be the preserve of a very few hyper intelligent individuals.

Machine Learning libraries like Tensor Flow are incredibly popular, allowing Python programmers to quickly create Machine Learning models and train these models to look for patterns in large amounts of data. This has led to high demand for coding professionals who can use Python and Machine Learning libraries like Tensor Flow to build and train data models.

Python is widely available for free (open-source), making it’s adoption popular amongst a wide range of users from the hobbyists, schools to businesses. This popularity is driven further by it’s ease of use. Python is available on many different platforms, from Microsoft Windows, Linux to MacOS making it accessible to many more people.

Why is Python considered hard for some people?

Some people who have little or no previous technical experience may find Python difficult to learn and a hard language to get to grips with. Whilst those, who have some technical experience will find it easier to learn. The Object Orientated Programming (OOP) nature of complex Python programming may also mean it’s difficult for some people to come to terms with.

By starting at the basics and building knowledge through learning Python will make any transition from basic coding to complex coding much easier to understand. As Python is a high-level language learning it, is a lot easier than low-level languages, as the complexities of the operating system need not be known by the programmer.

Depending on why Python is being learnt will have a bearing on how hard people find python, as some circumstances like web development using a variant of Python like Flask may be easier to grasp for some people than complex data modelling using complicated data modelling libraries and functionality.

What is Python written in?

As python is a high level language that requires interpretation, it in itself must be developed in a lower level language, allowing the interpretation to be understood by the computer or devices operating systems.

An operating system like Microsoft Windows, Linux to MacOS can have their functionality accessed using the low level language. So if in Python, code to open and read a file is run, this code is interpreted into a low level language the operating system can understand, allowing the file to be accessed and opened.

Python’s traditional development meant it was written using the C programming language which provides a low level language capable of providing the interpretation layer from python to the operating system on the computer or device. Later instantiations of python have used C++ as this became popular after the original development was done.

The C programming language is incredibly fast and with it’s speed comes a level of complexity, making it a difficult language to learn. However by creating a language using the C programming like Python, the complexity can be reduced, as the code in Python is interpreted by C allowing operating systems to take action on the code.

In later years, C++ became the defacto standard for developing low-level code including the drivers that are needed to interact with the operating system where Python will be installed. C++ code needs to also manage the memory allocations, pointers to the garbage collection of functions that have completed. This level of knowledge is not required by Python, as the C++ code it is built with, will handle all of this.

There are also Java versions of Python created like Jython, where the code base of Jython has been written in Java. Jython allows Python code to be run in a Java applications code. Jython can run on different platforms as it runs in a Java Virtual Machine (JVM), so where there is a JVM maybe a Microsoft Windows environment to a Linux environment, Jython can run.

Learn Python or SQL first?

Many popular python frameworks like Django use a Model View Controller (MVC) architecture along with Object Relationship Mapping (ORM) libraries to provide an abstraction layer when it comes to accessing related data from a database. This takes away a lot of the mechanics of constructing SQL queries to interact with relationship databases and also non-SQL type databases.

Learning SQL first before learning Python can be a wasted exercise as the way Python especially associated frameworks interact with databases using models and data objects where actual SQL code is not used. Thereby learning Python first, a better understanding of the level of SQL knowledge to be acquired can be ascertained instead of learning SQL in depth only to find you don’t actually need to know it all.

As many framework in Python use data models and ORM for data access, manipulation and storage, knowing SQL queries first is not beneficial instead of just learning Python first. As the level of SQL knowledge required when using the Python functionality will be a limited subset. Meaning additional SQL will not have to learnt other than what’s required for Python. This will undoubtedly save time in learning both Python and SQL.

The python frameworks have libraries specifically for Object Relationship Mapping (ORM) that provide a layer between python and a database where SQL queries can be executed in a safe and secure manner. This is due to the way the SQL query is run using parametrization and escaping making it very difficult to allow malicious SQL queries to be executed.

Along with the models used in the architecture especially MVC architectures of popular Python frameworks where the relationships between the different types of data models are created. Allowing for these models to be accessed instead of the databases directly, meaning the need for raw SQL queries along with this knowledge is minimized.

A simple example to show the difference in syntax is shown below, with the first database query constructed using ORM in a common Python framework, whilst the second one is a raw SQL query. The complexity of complicated SQL is hidden by using the ORM along with the safety and security in the additional protections the ORM and data models provide.

  1. contacts = Mycontacts.objects.order_by(‘fullname’);
  2. SELECT fullname FROM Mycontacts;

As you can see the syntax in how the SQL query in 2 is executed, is different in the first example, as this uses a model and assigned data object to get the information from the database. It does this in a way which is secure and safe.

Depending on the database you are connecting to, the SQL queries syntax could be different. Thereby having you learn one flavor of SQL only to find it isn’t quite the same as the database you are planning on using, would be a waste of time.

This is where the data layer provided by ORM comes into it’s own, as you only have to change the driver this uses to that of a particular database without the need to change any of the data layer code. As the changes in database are handled transparently by the ORM, that is the data layer using the appropriate database driver.

This is an important aspect as it allows you to develop a Python program using a free open source database like SQLite and then when a commercial database is needed like Microsoft SQL, the only change required, is the change of configuration to use the new database driver, that is the Microsoft SQL driver.

Learning SQL whilst you are learning Python is a good way to progress, as you will only have to learn the bare essentials in SQL to progress. Saving time and energy, allowing you to fully concentrate on the other aspects of Python.

Can we use Python for front end?

There are many programming languages, with some designed for front-end whilst others are predominantly designed for the back-end. With the front-end providing the user interface for users to use and back-end involved with processing the information sent from the front-end to the back-end.

Python is generally considered a back-end language where it is installed on a server in a data center instead of being installed in the web browser of a user at the front-end. Python sends representative browser code back to the front-end web browser as HTML.

That being said, when learning python people install it on their computers and use it without a back-end to do the processing, instead using python as their user interface and running the associated logic. Whilst this is great for learning, using python where multiple users need to access programs at the same time, the best option is to use python as a back-end service.

Frameworks like Flask and Django provide web interface where web pages constructed using these frameworks are sent to the users browser. These frameworks contain libraries and functionality that makes it easier to develop web applications.

Full Stack development can include using a Front-End framework like Angular, Vue.js to React which use JavaScript and can interact with Python at the back-end. Python at the back-end can provide the authentication, authorization, database queries and other services associated with the full stack application. Whilst the front-end framework like Angular provide the user interface the user will use.

The popularity of Single Page Applications (SPAs) created using frameworks like Angular are a great way to interact with Python. Allowing for the development of an application that can scale out, depending on the number of users or even the locales of where the users using the application are based.

Summary

Python is not a hard language due to it’s high level syntax making it easy for those new to programming to quickly get to grips with the language. Moreover, Python has numerous frameworks like Flask and Django that provide a further abstraction layer to learning easily.

Python is a high level language that is interpreted by the operating system on the device or computer where Python is installed. Therefore, a low-level language like C or even C++, is used to develop Python, as these low-level languages can talk directly to the operating system. Intercepting calls made from the Python applications and making the appropriate low-level calls to the operating system. Operating systems can include Microsoft Windows, Linux to MacOS.

Learning both Python and SQL at the same time is highly recommended, as this will save time as only the relevant SQL syntax associated with Python needs to be learnt. Moreover, if the Object Relationship Mapper (ORM) data layer is used, SQL might not be learnt at all, as this will use data objects and the relationships between them to query the database.

Python is generally classed as a back-end language when used commercially, providing the application logic whilst the front-end, like Angular provides the user interface. When learning Python, many people use Python as the user interface where the logic is displayed on the screen, or with frameworks like Django and Flask, the logic is displayed in the users web browser.

Bal Kang

Bal Kang is a technology expert based in the UK, with experience across a number of technology areas from phones, tablets, computers to gaming.

Recent Posts