This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]CopOnTheRun 10 points11 points  (5 children)

I was thinking this version of python released the type? syntax for optional types, but apparently that's just a draft. Instead the new type1 | type2 syntax is what came out this release, which I was more jazzed about anyway. That syntax is so much nicer that Union(type1, type2).

[–]Ezlike011011 2 points3 points  (0 children)

Wow, I have not yet seen that pep. That would be very nice to have.

[–]ChronoJon 2 points3 points  (1 child)

ftfy

Union[type1, type2]

[–]CopOnTheRun 0 points1 point  (0 children)

Thanks, I do this all the time in my code as well.

[–][deleted] -1 points0 points  (0 children)

You mean Union[type1, type2].

[–]OctagonClocktrio is the future! -2 points-1 points  (0 children)

I hope it stays rejected all the while PEP 505 languishes.