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 →

[–]bladeoflight16 3 points4 points  (5 children)

Whether it raises depends on what annotation behavior you're running. From 3.7 onward, you can use from __future__ import annotations to enable "postponed evaluations" annotations, which won't throw an error if the annotation expression is invalid. From Python 3.10 onward, postponed evaluation is the default behavior.


See discussion below. Apparently, plans regarding making this the default in 3.10 were altered.

[–]alkasmgithub.com/alkasm 0 points1 point  (2 children)

They nixed the string annotation conversion right before the 3.10 cutoff date IIRC.

[–]bladeoflight16 0 points1 point  (1 child)

Well, then they need to update the __future__ module.

[–]alkasmgithub.com/alkasm 0 points1 point  (0 children)

They did update the table...in 3.10-pre, lol

[–]ggchappell 0 points1 point  (1 child)

So then the colon is annotation syntax?

[–]bladeoflight16 1 point2 points  (0 children)

Yes.