Reduce need of backslash

John Roth newsgroups at jhrothjr.com
Fri Sep 26 14:10:08 EDT 2003


"Nicolas Fleury" <nid_oizo at yahoo.com_remove_the_> wrote in message
news:MI_cb.75294$PD3.4794043 at nnrp1.uunet.ca...
> Peter Otten wrote:
>
> > Nicolas Fleury wrote:
> >
> >
> >>I was wondering if the need for \ could be reduce in the language.  For
> >>example, could a line ending with = or + could be automaticly considered
> >>incomplete?
> >
> >
> > Did you know about (...)?
>
> Actually, no.  But it's still not what I'm looking for.  It's just that
> I'm used to languages where I can put my code on multiple easily to make
> lines shorter.  As John pointed, it's possible to add () to print.  I
> just discovered that it can be done with return also.  I wonder how to
> remove the need for \ in that example:
>
>      parser.StartElementHandler = \
>          lambda name, attrs: \
>              GenericParser.handleElementStart(self, name, attrs)

How about:

    parser.StartElementHandler = (lambda name, attrs:
        GenericParser.handleElementStart(self, name, attrs))

John Roth
>
> Regards,
>
> Nicolas
>






More information about the Python-list mailing list