What actually are Cpython, IronPython and PyPy? [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I was googling for some demo Python code I found few sample codes which say they use IronPython, CPython and PyPy so I then searched for what they actually are and found that these are already written code arenas from where we can pick functions and use them. But I am not actually sure on how to use them in my code.
And also can I use all of them at once in my single code.

CPython is the original implementation of the Pythn language (written in C). IronPython is an implementation of the Python language that runs on the .NET framework and PyPy is another implementation of Python using Just-In-Time compilation for faster execution speeds.
They are all Python interpreters, and for learning the language it does not matter much which one you use. I prefer using CPython, since it's pre-installed on many systems, but if you need access to .NET libraries from Python or need faster code, I guess IronPython or PyPy would make sense to use.

Yes, you could use both and PyPy is interpreter and just-in-time compiler focused on speed, efficiency, and compatibility with CPython.
good luck

Related

How to make opencv for real time system? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Real time system requires a fast & efficient platform. I wonder which combination is suitable for real time image processing: OpenCV-Python, OpenCV-MVStudio (C++), OpenCV-Matlab or OpenCV-Java? I had read about CUDA, but if I don't want to use CUDA for my project, is there any way to develop a fast system?
I can comment on MATLAB, Python and C++, but not Java:
To run OpenCV in MATLAB you will need something along the lines of mexopencv (http://kyamagu.github.io/mexopencv/). This compiles many of the OpenCV functions (not all functions are included) into mex files which MATLAB can read and use. It works but is probably not the fastest solution for real time applications. But it is useful for prototyping.
Running OpenCV in Python is easier and runs more efficiently, though it is still "indirect" as it requires a Python wrapper (as OpenCV is written in optimized C/C++).
The most efficient solution for real-time algorithms would be to use the native language of OpenCV, i.e. C++, avoiding the translation step between languages.
CUDA, or parallel processing in general, is an option for all these platforms. However whether it will benefit the speed of your code depends largely on the project itself. Often parallelising something can make it run slower instead of faster. Have a look at https://en.wikipedia.org/wiki/Parallel_slowdown for info.
Hope this helps!

Django - Use Python3 or 2.7? Longevity and performance of project [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
Although this could be downvoted as an opinion based issue, I suspect there is a concrete answer to this:
I want to create a future-proof django project.
I want to maintain the best coding standards
I do in fact require a diversity of other python modules for the apps I am creating
I am shooting for best performance
With that in mind, should I stick to python2.7 because of it's great support and use? Or would it be better to use python3 because it is the way of the future?
Django's official stance is, as long as your dependencies support Python 3, to use Python 3. Python 3 has and will continue to receive new features and improvements, including better performance.
Unless you need modules that would be hard to port to Python 3 (simple ones can often be fixed just by running the builtin 2to3 tool), there isn't any reason not to use Python 3.
If the Python modules required are available for Python 3.x, then I would go ahead with the latest stable release. If not, don't be afraid to use Python 2.7 since performance is great and many 3.x improvements have been backported.
However, take into account that sooner or later you'll have to migrate to Python 3.
I would stick to python 2.7. It is more commonly used, and has lots of support.

How to compile c, c++ and python code as “Released/Final” version? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I want to know if there are ways to compile C, C++ and Python code in order to not be able to reverse engineering it over Linux or not?
I have heard there are some ways over Windows to do it, but I am working on Linux.
I want to compile my code securely, as released or final version.
UPDATE
At least I want to make it hard for usual users to disassemble,
I am using GCC for C and GPP for C++, also I would be thankful if you introduce me best compiler for Python.
I want to know if there are ways to compile c, c++ and python code in order to not be able to reverse engineering it over Linux or not?
You could always obfuscate the code, but know this: A dedicated reverse engineer can not be stopped. As someone else once said on this site: You can't protect your code technologically, only legally.
I want to compile my c, c++ and python code securely... as released or final version...
Well, as far as python is concerned, you could always ship the software as an executable created by an exe packager such as py2exe or freeze. Refer to this question.
also I would be thankful if you introduce me best compiler for Python
In the Python world, you aren't talking about a compiler, rather, about a specific implementation. Most people use the reference cpython implementation. There are also alternatives such as pypy or jython,
but they are not dedicated compilers, rather, full blown virtual machines.

PyPy vs Cpython, will either one drop GIL and support POSIX Threads? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
Given that the GIL limits pythons ability to support true threads, is it possible to strip it out of current python implementations so that the language can finally support true multithreading. Furthermore, assuming that the GIL is dropped, would that mean that multi-core threading would finally come to scripting/interpreted languages such as Python and Ruby?
Your question is flawed.
Python supports threads just fine. In fact, when you create a thread in a Python program running under a *nix it likely creates exactly one additional pthreads thread, no questions asked.
The only restriction is that Python code won't run in parallel (but it does run concurrently, interleaved, etc.). Code that's not under the GIL, such as almost everything that does I/O, doesn't prevent other threads from running Python code.
As for removing the GIL... it's hard. Like, really really hard. You and me can just assume it's infeasible (hey, at least we'll be pleasantly surprised if some superhuman does succeed). Other implementations (Jython, IronPython) don't have a GIL, but their approaches aren't practical for CPython (and not easy for PyPy either, from what I hear) and they can't exactly replace CPython as they lag behind a lot, don't support C extensions, are less portable to more exotic platforms, etc.
That said, some PyPy developers are working on an STM solution (latest update) that would free PyPy from the GIL. CPython on the other hand? I don't think there's a chance, even with STM, especially when potential ABI and API breakage is taken into account.

What "kind" of Python to start with? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I want to learn python so I downloaded it from the python site and I saw 4 other kinds of pythons appear:
Python (normal)
IronPython
Jython
PyPy
Stackless Python
I can really find what the differents are between these.
Also which one is the best to start with.
Updated to include corrections from kind people in the comments section:
Of the python implementations you mention, the original and most commonly used is CPython (python on your list - which is an interpreter for python implemented in C and running as a native application) and is available for pretty much every platform under the sun. The other variants are:
IronPython: runs on the .Net common runtime (interfaces more cleanly with other .Net apps)
Jython: runs on the JVM (interfaces more cleanly with Java and other JVM apps)
PyPy: A Python interpreter which includes a just-in-time compiler which can significantly increase program execution performance. The interpreter and JIT are implemented in RPython (rather than C), a restricted subset of Python which is amenable to static analysis and type inference.
Stackless Python: An implementation of a python interpreter which doesn't rely on recursion on the native C runtime stack, and therefore allows a load of other interesting programming constructs and techniques (including lightweight threads) not available in CPython.
There are a large variety of libraries for Python (one of the major advantages of the language), the majority developed for CPython. For a number of compatibility reasons, none of the variants above currently support as many as the main implementation. So for this reason, CPython is the best place to start, and then if your future requirements fit one of the other platforms - you'll be in a good place to learn the variations from a solid grounding in the basics.
Python. All the documentation you'll find for learning the language assumes this. Then if you find a need for one of the other implementations the documentation will assume you know Python and explain the differences.
Start with Python.
The alternatives are for special use cases that apply mostly when you are integrating Python with other languages, which is a very advanced usage of the language.

Categories

Resources