I also, for this kind of things that seems to be coming out once in a while, tend to start from AST and a "pretty printer". This has limitations since AST doesn't give you type informations (not that it matters much for Python) but it's good for a "first pass" of translation.
Here is my latest attempt, prompted by this thread: https://github.com/raff/gopyr. The initial implementation was in Python, but then I found https://github.com/go-python/gpython, and I decided to rewrite it in Go. Not completely done yet. Next big thing would be making object methods real object methods (easy, just need to get it done). Then I would like to move nested classes or nested function to the outer scope. And then, I am not sure of far I should take. I did list and dict comprehension, as anonymous function. But should I do generators ? (anonymous function returning a channel fed by a goroutine ?). Certainly feasible but at what point would it be better to just leave the code as is and let the human write idiomatic Go ? -- Raffaele On Thu, Oct 4, 2018 at 2:25 AM Eric Raymond <e...@thyrsus.com> wrote: > > > On Thursday, October 4, 2018 at 4:26:44 AM UTC-4, Peter Waller wrote: >> >> My approach is a bit different, and works by printing the Python AST in >> Go. There is an overlap in our philosophy of 'produce standalone code' and >> 'help a human do the translation into idiomatic Go'. However, mine was a >> Saturday morning project which was never used in anger, so it is naturally >> quite incomplete. >> >>> >>> > Oh, good. We now have direct competition between a swarm-rule approach > and a deep-reasoning approach. It will be very interesting to see which > does better in the long run. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.