On Fri, 4 Mar 2016 03:47 am, Marko Rauhamaa wrote: > John Gordon <gor...@panix.com>: > >> In <871t7sbkex....@elektro.pacujo.net> Marko Rauhamaa >> <ma...@pacujo.net> writes: >> >>> Ethan Furman <et...@stoneleaf.us>: >> >>> > No, it isn't. Using '\' for line continuation is strongly >>> > discouraged. >> >>> Why would you discourage valid syntax? >> >> Some things that are permissible may not be desirable. > > Line continuations are such a central part of the syntax that it would > seem silly to deprecate them.
What a wonderfully wrong sentence! Line continuations are not a central part of the syntax, they've very much a minor and rarely used part. Indentation is a central part of the syntax. Students need to learn about indentation right from the beginning, and it is barely possible to go ten minutes of writing Python code without using indentation. But line continuations? It is quite possible to go years between seeing \ line continuations in code, and it is never *necessary* to use them. Nevertheless, they are not deprecated. They are just *discouraged*. Are you familiar with the difference? Deprecate: a formal or semi-formal process whereby features are removed from a programming language. Discourage: a social process whereby use of a feature is deterred but not prohibited. > While it is true that > > if a and \ > b: > pass > > is ugly, > > if (a and > b): > pass > > is even uglier. It's silly to break such short expressions over multiple lines, and you cannot judge the aesthetics of long expressions by looking at short ones. class C: def method(self): if (result is None or self.some_condition() or len(some_sequence) > 100 or some_other_condition or page_count < 5 ): do_processing() Looks fine to me. -- Steven -- https://mail.python.org/mailman/listinfo/python-list