[Python-Dev] Adding a conditional expression in Py3.0
John J Lee
jjl at pobox.com
Wed Sep 21 01:37:27 CEST 2005
More information about the Python-Dev mailing list
Wed Sep 21 01:37:27 CEST 2005
- Previous message: [Python-Dev] Adding a conditional expression in Py3.0
- Next message: [Python-Dev] Adding a conditional expression in Py3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 21 Sep 2005, Thomas Lotze wrote:
> Barry Warsaw wrote:
>
> >> x = (if a then
> >> b
> >> elif c then
> >> d
> >> else
> >> e
> >> )
> [...]
> >
> > I guess that's my point. To me, your latter is actually worse than
> >
> > if a:
> > x = b
> > elif c:
> > x = d
> > else:
> > x = e
>
> Can't see a difference as far as readability is concerned. But then,
> tastes differ.
[...]
With the former, we have a more C-style syntax where meaning is determined
purely by delimeters rather than by whitespace. Instead of braces '{' and
'}', we have 'then' and 'elif'/'else'. That's a real difference.
The stricter form where you don't allow 'elif' will get used in more
restricted circumstances, so gives less encouragement for widespread abuse
of conditional expressions by people who don't like whitespace-based
syntax.
John
- Previous message: [Python-Dev] Adding a conditional expression in Py3.0
- Next message: [Python-Dev] Adding a conditional expression in Py3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list