[Python-ideas] with statement syntax forces ugly line breaks?

Ben Finney ben+python at benfinney.id.au
Thu Sep 9 09:55:38 CEST 2010


"Gregory P. Smith" <greg at krypto.org>
writes:

> On Wed, Sep 8, 2010 at 10:00 AM, Nathan Schneider <nathan at cmu.edu> wrote:
> > I have approached these cases by using the backslash line-continuation
> > operator:
> >
> > with FakeContext("a") as a, \
> >   FakeContext("b") as b:
> >   pass
>
> I'm in the "\ is evil" at all costs camp […]

I agree, especially when we have a much neater continuation mechanism
that could work just fine here::

    with (FakeContext("a") as a,
             FakeContext("b") as b):
         pass

-- 
 \      “[Entrenched media corporations will] maintain the status quo, |
  `\       or die trying. Either is better than actually WORKING for a |
_o__)                  living.” —ringsnake.livejournal.com, 2007-11-12 |
Ben Finney




More information about the Python-ideas mailing list