gotopy

command module
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2021 License: BSD-3-Clause Imports: 19 Imported by: 0

README

GoToPy

GoToPy is a Go to Python converter -- translates Go code into Python code.

To install, do standard:

$ go install github.com/go-python/gotopy@latest

It is based on the Go gofmt command source code and the go printer package, which parses Go files and writes them out according to standard go formatting.

We have modified the printer code in the pyprint package to instead print out Python code.

The -gopy flag generates GoPy specific Python code, including:

  • nil -> go.nil
  • []string{...} -> go.Slice_string([...]) etc for int, float64, float32

The -gogi flag generates GoGi specific Python code, including:

  • struct tags generate: self.SetTags() call, for the pygiv.ClassViewObj class, which then provides an automatic GUI view with tag-based formatting of struct fields.

TODO

  • switch -> ifs.. -- grab switch expr and put into each if

  • string .contains -> "el" in str

  • map access with 2 vars = if el in map: mv = map[el]

  • for range with 2 vars = enumerate(slice)

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package diff implements a Diff function that compare two inputs using the 'diff' tool.
Package diff implements a Diff function that compare two inputs using the 'diff' tool.
Package printer implements printing of AST nodes.
Package printer implements printing of AST nodes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL