allow line break at operators

Ben Finney ben+python at benfinney.id.au
Wed Aug 10 17:51:32 EDT 2011


Seebs <usenet-nospam at seebs.net> writes:

> On 2011-08-10, Chris Angelico <rosuav at gmail.com> wrote:
> > And if we require {} then truly free indentation should be OK too!
> > But it wouldn't be Python any more.
>
> Would it really not be Python at all?

See the Python interpreter's response to ‘from __future__ import braces’.

> I've seen bits of code in preprocessing-based "Python with {}" type
> things, and they still look like Python to me, only they favor
> explicit over implicit a little more strongly.

They introduce unnecessary ambiguity: the indentation-as-structure and
braces-as-structure can then disagree.

In which case either the Python interpreter must guess the programmer's
intent (very un-Pythonic), or it throws an error and the programmer must
do busy-work to keep braces and indentation in agreement (also
un-Pythonic).

The ambiguity is resolved by having exactly one of indentation or braces
determining structure: Python uses indentation. In which case, braces
are pointless for indicating block structure.

-- 
 \            “Without cultural sanction, most or all of our religious |
  `\          beliefs and rituals would fall into the domain of mental |
_o__)                                 disturbance.” —John F. Schumaker |
Ben Finney



More information about the Python-list mailing list