Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tool to convert python to c# [closed]

Tags:

Is there any tool or way in which I can convert or translate python code to c# code?

like image 939
user1509 Avatar asked Jul 07 '12 09:07

user1509


People also ask

Can I convert Python code to C?

Python code can make calls directly into C modules. Those C modules can be either generic C libraries or libraries built specifically to work with Python. Cython generates the second kind of module: C libraries that talk to Python's internals, and that can be bundled with existing Python code.

Is there a program that converts Python to C++?

Nuika (open source on GitHub) compiles Python to C++ code, which can then be executed in-place or packaged up as a stand-alone file for redistribution. Unlike some other replacements for existing Python interpreters, it claims full compatibility with all the language constructs in Python 2.6, 2.7, 3.2, and 3.3.

Can Cython convert Python to C?

The Basics of CythonThe Cython compiler will convert it into C code which makes equivalent calls to the Python/C API. But Cython is much more than that, because parameters and variables can be declared to have C data types.

How do I make my Python as fast as C?

Although C remains the master of speed in general, PyPy can beat C in some cases. “If you want your code to magically run faster, you should probably just use PyPy.” PyPy is less effective when our program is fast anyway or when most of the runtime is spent for calls to non-python libraries.


2 Answers

There is an opensource tool that may be useful for conversion of Python to C#:

https://github.com/uxmal/pytocs

the sample conversions in that page look promising

like image 151
George Birbilis Avatar answered Oct 07 '22 20:10

George Birbilis


Hm, wouldn't it be wiser to reuse the existing Python code base via IronPython, for example?

like image 23
Paul Michalik Avatar answered Oct 07 '22 19:10

Paul Michalik