GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - go-python/gotopy: Go to Python converter -- translates Go code into Python code

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

21 Commits
21 Commits

Folders and files

NameName
Last commit message
Last commit date
diff
diff
 
 
pyprint
pyprint
 
 
testdata
testdata
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
format.go
format.go
 
 
go.mod
go.mod
 
 
gotopy.go
gotopy.go
 
 
gotopy_test.go
gotopy_test.go
 
 
parse.go
parse.go
 
 
pyedits.go
pyedits.go
 
 
rewrite.go
rewrite.go
 
 
simplify.go
simplify.go
 
 
version.go
version.go
 
 

Repository files navigation

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)

About

Go to Python converter -- translates Go code into Python code

Topics

convertergogolangpythontranslation

Resources

Readme
BSD-3-Clause license
Activity
Custom properties

Stars

37 stars

Watchers

1 watching

Forks

7 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.