[Python-ideas] Python-ideas Digest, Vol 140, Issue 169

James Lu jamtlu at gmail.com
Thu Jul 26 10:02:40 EDT 2018


> I several times wished I could have had a reference to the block of code in a `with` clause.

Could you abstractly describe a real-world example of this? I’d like to hear your use case. 

> The example for sorted is also kinda twisted.

It is, it’s probably a counterexample on how to use it.

I forgot to mention, could it be possible to only treat do as a keyword when it’s used in an as-do expression? So, do remains a legal variable name, and do is only interpreted as a keyword when it’s in an as-do expression. I believe this is possible using the Python grammar. 


More information about the Python-ideas mailing list