nottheswimmer/pytago

decorator convert wrong

asukaminato0721 opened this issue · 0 comments

Describe the bug
A clear and concise description of what the bug is.

Python code example
The simplest possible Python code example to demonstrate the bug.

def main():
  def test(f):
    def inner(*args):
      print(args)
      f(*args)
    return inner
  @test
  def x(a,b):
    return a,b
  x(1,2)

if __name__ == '__main__':
  main()

Current behavior
What the program currently outputs for the code example.

package main

import "fmt"

func main() {
	test := func(f interface{}) {
		inner := func() {
			fmt.Println(args)
			f(args...)
		}
		inner
	}
	x := func(a int, b int) [2]int {
		return [2]int{a, b}
	}
	x(1, 2)
}

Expected behavior
A clear and concise description of what you expected to happen.

the decorator changes the function's behavior.

Go code example
Optional. An example of a satisfactory Go code output for the Python example.