Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decorator convert wrong #15

Open
asukaminato0721 opened this issue Feb 23, 2022 · 0 comments
Open

decorator convert wrong #15

asukaminato0721 opened this issue Feb 23, 2022 · 0 comments

Comments

@asukaminato0721
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant