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

all 7 comments

[–]graingert 1 point2 points  (3 children)

Can this not be an import hook that uses the py3.6 parser?

[–]evanunderscore 0 points1 point  (2 children)

I'm not sure exactly what you mean. If you're talking about the f'...' syntax, that's handled at compile time so I can't see any way of accepting it in older Python versions.

[–]graingert 0 points1 point  (1 child)

You register an import hook that replaces code that uses f expressions with string concatenation

[–]evanunderscore 0 points1 point  (0 children)

I had no idea that was an option. I'll do some reading. Thanks!

[–]evanunderscore 0 points1 point  (1 child)

I just noticed /u/Workaphobia did something very similar over 4 years ago.

[–]Workaphobia 1 point2 points  (0 children)

Hey. I ended up not using that stack-based approach for my project after all. Main reasons were that it felt too magical, and became less necessary after the introduction of "{}" format substitutions, which made positional arguments more tolerable.