Skip to content

weimingtom/pytocs

 
 

Repository files navigation

pytocs

Converts Python source to C#

pytocs is a hobby project I wrote to convert Python source code to C#. I've uploaded it here in case someone finds it useful.

Examples

To convert a Python file, hand it to pytocs:

pytocs foo.py

To convert all files in a directory (recursively), use the -r parameter:

pytocs -r 

The following python fragment:

# Some code below
def hello():
   print "Hello World";

Translates to:

public static class hello {

    public static object hello() {
	    Console.WriteLine("Hello World");
    }
}

Roadmap

The next big items on the list are:

  • Take the types that are inferred and apply them to the code to get away from everything being object.
  • Place local variable declarations at the statementent that dominates all definitions of said variables.

About

Converts Python source to C#

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 99.9%
  • Other 0.1%