Python Newbie

MRAB python at mrabarnett.plus.com
Sun Feb 24 21:34:53 CET 2013


On 2013-02-24 19:40, piterrr.dolinski at gmail.com wrote:
>>> if (some statement):		# short form
>>>
>>> rather than
>>>
>>> if (some statement == true):	# long form
>>
>>
>> What all those ugly brackets are for?
>>
>
> Mark,
>
> Back in the day when C was king, or take many newer long established
> languages (C#, Java), the use of () has been widespread and mandated
> by the compilers. I have never heard anyone moan about the
> requirement to use parentheses. Now come Python in which parens are
> optional, and all of a sudden they are considered bad and apparently
> widely abandoned. Do you really not see that code with parens is much
> more pleasing visually? I could understand someone's reluctance to
> use parens if they are very new to programming and Pythons is their
> first language. But my impression here is that most group
> contributors are long-time programmers and have long used () where
> they are required. Again, I'm really surprised the community as a
> whole ignores the programming "heritage" and dumps the parens in a
> heartbeat.
>
Some languages require parentheses, others don't.

C does. C++, Java and C# are descended from, or influenced by, C.

Algol didn't (doesn't?). Pascal, Modula-2, Oberon, Ada, and others
don't.

Parentheses are used where required, but not used where they're not
required, in order to reduce visual clutter.



More information about the Python-list mailing list