[Python-ideas] Object grabbing

Alexander Walters tritium-list at sdamon.com
Mon May 2 08:44:18 EDT 2016


with open(foo), open(bar):
     .write(baz)  # does what?

On 5/2/2016 08:20, Koos Zevenhoven wrote:
> On Mon, May 2, 2016 at 2:48 PM, João Santos <jmcs at jsantos.eu> wrote:
>> I think the ".d = 1" statement feels like a bug waiting to happen. It's very
>> easy to miss a dot.
>>
> I suppose that's a valid concern, especially regarding assignments,
> because the code typically would still run. But in the beginning of
> the line, it is usually quite easy to see if there's a dot or not,
> assuming a fixed-width font and proper indenting.
>
> Anyway, it seems to me this would make sense in with statements:
>
> with open(filename):
>      #do stuff
>      .write(stuff)
>      #do more stuff
>      .write(more_stuff)
>
> -- Koos
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/



More information about the Python-ideas mailing list