yglukhov / nimpy

Nim - Python bridge
MIT License
1.48k stars 60 forks source link

Support for more than one argument type #257

Open qb-0 opened 2 years ago

qb-0 commented 2 years ago
import nimpy

proc foo(a: int|string) {.exportpy.} =
  when type(a) is int:
    echo "Got int"
  elif type(a) is string:
    echo "Got string"

foo(100)
foo("Hello")

Fails currently with invalid type: 'void' for var