Currently constant folding is suppressed if it causes an exception, e.g.
def f():
return 1/0
generates code to perform the division at run time. I think that’s the
right thing to do – the function might not get called at run time, so
making it a compile time error would change the behaviour of the program.
Yes, people including myself sometimes have to settle with using a fixed-size list of heterogenous items just to be able to, for example, increment an integer item, without using a heavier class-based data structure. And there’s no typing support for it.
I for one have advocated for frozendicts literal for a long time, in other discussions - and the `f{` prefix seems to be the “one obvious way to do it”. Now that there are frozendicts, we get two (cognitive things to learn) for the price of one, so it’d be even better.
I’d go as far as including frozen sent comprehensions and frozen dict comprehensions on the same change (as there are no drawbacks, there would be little motivation to do the literals now and comprehensions later, and it would even be awkward to explain, in a class enviroment, why literall accept the `f` prefix and comprehensions not.
For the record - I consider the syntax proposal optimal and obviois - and I suppose a lot of other people does as well. So I am voicing that, since simple “I agree with that” might have a diminished signal in the discussion.
Hi, I think we’ve received enough feedback over the past two weeks. We’ll revise the PEP based on that feedback and prepare for the next round of discussion with the updated version.