- Community Home
- >
- Software
- >
- Software - General
- >
- Python's Late Bloomers vs. Compiled Languages' Ear...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2024 05:07 AM
07-08-2024 05:07 AM
Python's Late Bloomers vs. Compiled Languages' Early Birds: The Comedy of Errors
Python's Late Bloomers vs. Compiled Languages' Early Birds: The Comedy of Errors
Have you ever waited a long time for your python code to finish executing, only for it to fail midway? The first thought all of us would have, after our patience is thoroughly tested is: “Why didn’t it just fail in the beginning and save us the time?” and the answer to this question is the fact that Python is an interpreted language, and it reads and executes your code line-by-line.
Meanwhile, an error in a Compiled language like C, C++, C#, COBOL would have been caught before execution and this is because your source code gets compiled into machine code/binary before execution and any error that occurs, gets caught during the compilation phase, before it reaches the execution phase.
Here is an example on how this works with respect to Python and C++
Python
In the above Python code, we have a Type Error (This error happens because of a data type mismatch, here 10 is an integer, whereas ’20’ is a string), but this error is only detected after reaching line 6.
C++
The above C++ code fails before execution because of a type mismatch and hence did not print the statement.
Examples of some common run-time errors and the try-except block
In Python, the syntax errors are caught during the initial parsing, before the program is run. Here are some run-time errors that can be handled using the “try-except” block. These are the errors that you would come across frequently.
1: Type Error: This error occurs when an operation is performed on an object of an inappropriate type. Like in the example above in which an integer was being added to a string.
Handling: You can handle this error by using either a print statement asking for the right object type to be entered or if it or if you are expecting a specific kind of error to happen like in this case a string being entered, you can write the code to handle a string by converting it into an integer.
2: Value Error: This error occurs when an operation is performed on an object of the right type, but inappropriate value. In the below example, the attempt to convert a non- numeric string (“Heyyy”) into an integer throws a Value Error.
Handling: Print statement
3: Index Error: This error occurs when your list index is out of range. In the below example, it looks for the value on index 5, but the list only has 3 values (0-2 index).
Handling: Print statement/ alternate custom error handling – In the below case I will look for (n-3) index if 5 is not found.
4: Key Error: This error occurs when a dictionary key is not found. If you are someone who uses dictionaries a lot, this error could cause major complications.
Handling: Print statements
There is a broad range of built-in exception-handling available in Python than can be leveraged to enhance code readability and maintainability.
Pros and Cons of an interpreted language
Python’s extensive standard libraries, third-party libraries like numpy, pandas, and requests, along with cross-platform support and scripting capabilities, make it the perfect language for automation. Python allows dynamic typing, meaning you don't need to define a datatype for a variable, unlike in compiled languages. This allows programmers to focus more on solving problems than managing data types explicitly. However, this feature can cause different runtime errors as discussed above.
While Python's error detection might take more time, leading to increased typing and interaction, it excels in debugging with print statements. It simplifies testing small snippets of code interactively. Although a detailed analysis of both types of languages requires considering factors like portability and performance, understanding why Python works the way it does and leveraging its dynamic interactive error reporting can enhance productivity and provide immediate feedback.
So, the next time you're frustrated, waiting for an execution result, remember that it could just be a blessing in disguise.
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2024 05:19 AM
07-08-2024 05:19 AM
Re: Python's Late Bloomers vs. Compiled Languages' Early Birds: The Comedy of Errors
Great Read!!! Valuable insights on Python versus compiled languages, thanks for sharing!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 02:58 AM
07-09-2024 02:58 AM
Re: Python's Late Bloomers vs. Compiled Languages' Early Birds: The Comedy of Errors
Hello Pearl,
The article is well-written, informative, and provides a good balance of technical detail and readability.
Great job!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2024 05:16 AM
07-09-2024 05:16 AM
Re: Python's Late Bloomers vs. Compiled Languages' Early Birds: The Comedy of Errors
Well written, easy to understand the fundamentals of language. Thanks for sharing!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 12:46 AM
07-10-2024 12:46 AM
Re: Python's Late Bloomers vs. Compiled Languages' Early Birds: The Comedy of Errors
Hi Pearl,
I wanted to take a moment to commend you on the fantastic article you wrote. Your insights and thorough really shone through, making it an engaging and informative read. It's clear that you put a lot of effort into it, and your dedication is truly appreciated.
Regards
Pramod
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2024 02:27 AM
07-10-2024 02:27 AM
Re: Python's Late Bloomers vs. Compiled Languages' Early Birds: The Comedy of Errors
Thank you Pramod!
[Any personal opinions expressed are mine, and not official statements on behalf of Hewlett Packard Enterprise]
