CQCL / guppylang

Pythonic quantum-classical programming language
https://pypi.org/project/guppylang
Apache License 2.0
33 stars 3 forks source link

Py keyword takes precedence over identifier with the same name #520

Open mark-koch opened 1 month ago

mark-koch commented 1 month ago

What happens if I write

@guppy
def f() -> int:
    py = lambda x: x+1
    return py(2)

?

_Originally posted by @aborgna-q in https://github.com/CQCL/guppylang/pull/515#discussion_r1782506340_

mark-koch commented 1 month ago

In see two options:

aborgna-q commented 1 month ago

I'd say option 1 is the more pythonic. There are no function keywords in python3. From a user perspective, if you can shadow print you should be able to do the same with py.