This reminds me of a previous proposal I can't remember if I hit the list with, 
allowing

    with open(filename.json, "r") as f:
        my_dict = json.load(f)

to be spelt as a single expression:

    my_dict = (json.load(f) with open(filename.json, "r") as f)

Obviously this would be more useful in comprehensions, but it might encourage 
people not to lazily write `json.load(open("filename.json", "r"))` because they 
want an expression, and end up leaving files open.

Eric
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/QR233SIBDHWDZLKWURUHXG37BDWJHA7Z/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to