Skip to content

map(int,["1","2"]) convert wrong #14

Open
@asukaminato0721

Description

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

map(int,["1","2"]) convert wrong

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

def main():
  x=map(int,["1","2"])
  print(x)

if __name__ == '__main__':
  main()

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

package main

import "fmt"

func main() {
	x := func() func() <-chan int {
		wait := make(chan struct{})
		yield := make(chan int)
		go func() {
			defer close(yield)
			<-wait
			for _, x := range []string{"1", "2"} {
				yield <- int(x)
				<-wait
			}
		}()
		return func() <-chan int {
			wait <- struct{}{}
			return yield
		}
	}()
	fmt.Println(x)
}

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

int should be translated.

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

def main():
  print(int("1"))
if __name__ == '__main__':
  main()

this returns a good result.

package main

import (
	"fmt"
	"strconv"
)

func main() {
	fmt.Println(func() int {
		i, err := strconv.ParseInt("1", 10, 64)
		if err != nil {
			panic(err)
		}
		return int(i)
	}())
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions