On 4/15/21 2:02 PM, Sebastián Ramírez wrote:
## Questions

I'm not very familiar with the internals of Python, and I'm not sure how the new syntax for `Union`s using the vertical bar character ("pipe", "|") work.

But would PEP 649 still support things like this?:

def run(arg: int | str = 0): pass

And would it be inspectable at runtime?


As far as I can tell, absolutely PEP 649 would support this feature.  Under the covers, all PEP 649 is really doing is changing the destination that annotation expressions get compiled to.  So anything that works in an annotation with "stock" semantics would work fine with PEP 649 semantics too, barring the exceptions specifically listed in the PEP (e.g. annotations defined in conditionals, walrus operator, etc).


Cheers,


/arry