←back to thread

317 points est | 1 comments | | HN request time: 0.209s | source
Show context
Derbasti ◴[] No.17450491[source]
Does this mean that I can write

    with file := open('filename'):
        data = file.read()
instead of

    with open('filename') as file:
        data = file.read()
I don't know how I feel about this.
replies(2): >>17450635 #>>17457397 #
1. thomasahle ◴[] No.17457397[source]
Exactly. Using "as" everywhere might require some small backward incompatible changes to make sure semantics line up, but at least then we wouldn't have redundant syntax.