Wikipedia definition of Python programming language is as followed; Python is a general-purpose high level programming language. Its design philosophy emphasizes code readability. Python claims to “combine remarkable power with very clear syntax”, and its standard library is large and comprehensive. Its use of indentation for block delimiters is unusual among popular programming languages. Python supports multiple programming paradigms (primarily object oriented, imperative, and functional) and features a fully dynamic type system and automatic memory management. Python is often used as a scripting language.and
Python is a programming language that lets you work quickly, it also integrate your systems more successfully. Python is a powerful programming language that is used in a wide variety of application domains. Python is often compared to Perl, Ruby or Java. Some of its key features are:
Fans of Python use the phrase “batteries included” to describe the standard library, which covers everything from asynchronous processing to zip files. The language itself is a flexible powerhouse that can handle practically any problem domain. Build your own web server in three lines of code. Build flexible data-driven code using Python’s powerful and dynamic introspection capabilities and advanced language features such as meta-classes, duck typing and decorators. Python lets you write the code you need quickly. And, thanks to a highly optimized byte compiler and support libraries, Python code runs more than fast enough for most applications. Python also comes with complete documentation, both integrated into the language and as separated web pages. Online tutorials target both the seasoned programmer and the newcomer. All are designed to make you productive quickly. The availability of first-rate book completes the learning package.andand
The programme I have chosen to compare against Python is Cobra. In this essay I will be comparing and contrasting between the two programming software. On comparison, I have found Cobra has a more compile-time in regards to the error checking time. I believe Cobra saves time when it comes to reporting more than one error at one time. Cobra allows simple local variable assignment, which is very similar to Python; however with Cobra they give you a warning if they are never used. In Cobra these errors are caught at a compile-time and hardly take place during execution, like Python. Cobra believes getting them out of the way early, which will increase productivity time.
Contracts have numerous benefits:
They become part of the document interface to a method, showing what is expected to invoke the method and what can be relied on when the methods returns.
They are technically enforced because they are executable.
They catch run-time errors early when errors are still easy to diagnose.
They are inherited by subclass methods so they do not need to be re-implemented (less coding).
They may encourage developers to do more upfront thinking about how their classes will be used.andand
The problem is that Python defaults to a binary floating point type even though most numbers that people input are base 10. To help address this Python offers an additional Decimal type that computes the correct numbers, but it must be used explicitly end, some would say, awkwardly:
So Cobra does the inverse, defaulting to an accurate decimal type and offering the floating point type as an option. A simple “f” suffix on a number such as “0.1f” gives the 64-bit point value. The types are built in with the names “decimal”, “float”, “float64” and “float32”. The type “float” is an alias for “float64”. Note that in both languages, “float” math operations are faster than “decimal”. However, most applications should prefer accuracy over speed that may not be noticeable or needed. For the other applications that really require more speed or compatibility with floating point based libraries, Cobra offers a command line option “number:float64” which changes the types of literals like “1.0” and “0.5” to float64. Furthermore, Cobra provides a built-in number type which defaults to decimal but changes to float64 with this option. You can also specify “-number: decimal” although the letter is redundant.andand
Cobra complies down to machine code right out of the box. And Cobra favours static types for local variables by inferring them from their assignment. This promotes more compile-time error checking, especially when invoking library methods. But it also promotes speed. Python has solutions for improving speed for its developers: you can write some of your Python modules in C and wrap them in SWIG. You can use Pyrex. Or you can stay in Python and “bring in” C or C++ via Inline or Weave. But with Cobra the speed is built in from the beginning. You do not get kicked out to another language or get forced to assimilate another tool. Cobra’s performance is close or equal to that of C# and Java, and is therefore significantly faster than Python. Iron Python claims to be around 1.8X faster than Python, but this is still far slower than Cobra. Also, some users have found Iron Python can significantly slower than CPython and Jython.andand
Some applications including financial analysis, simulation, search, neural networks, games, and more require numerous CPU cycles which can cause Step2 to become a bottleneck during development. Cobra enables a tighter development cycle by offering high level coding and fast execution simultaneously. Because Cobra has no Global Interpreter Lock (GIL), it can run threads in parallel up to the number of cores available. Combined with its inherent speed, you can pack a lot of computation in one process on one computer.andand
In regards to the syntactic improvements, Cobra shares much in common with Python:
Indentation denotes code blocks
For foo in bar
But Cobra does not strive to be backwards compatible with Python. This opens the door to some improvements. Cobra allows embedding expressions in string literals-often called “interpolated strings” in other languages. This turns every string literal into a mini-templating language.andand
The Cobra compiler is implemented in Cobra. This means that the entire time the implementers are maintaining Cobra, they are using Cobra. This really tightens up the feedback loop on usability and bugs. This is in contrast to most other languages that are typically implemented in some other language. That practice greatly reduces the time that the language maintainers spend using their own language.andand
These disadvantages to using Cobra are:
Documentation needs expansion.
Cobra classes are not malleable at runtime like Python classes are.
Like all budding languages, some people will pass over Cobra because it is new and, therefore, not yet popular. Fortunately, many people do not balk at “newness” as evidenced by the fact that many new languages of the past have gained popularity after their introduction, including Python and C#. The same will happen for Cobra, in time.
Cobra is not yet available for JVM.andand
My overall thoughts of both Python and Cobra programming language, after researching for hours, I came to the conclusion that although Cobra is the better programming language it is not as established as Python, as of yet. Cobra offers a lot more for the user compared to Python. However saying that, I have only used the Python programming language software, so I can not give an answer as a user. Although from all the research I had come across, I still believe that Cobra would be a better programming language to use.