Mandatory indenting (Was: Vote on PEP 308: Ternary Operator)

ilya dont_mail_me at example.com
Thu Mar 6 09:54:04 EST 2003


Clark C. Evans wrote:
> From my usage pattern, what is missing in python is a clear way
> to indicate (for the reader) a conditional assignment.  Certainly
> this is possible, but it isn't that easy to read:
> 
>    if quantity > 0: exit = "door"
>    else: exit = "doors"
> 
> I'd rather have something like...
> 
>    exit = (if quantity > 0: 'door'
>            else: 'doors')
May be you should use LISP ?
At least you can express exactly what you mean.
(setq exit (if (> quantity 0) "door" "doors"))
Or formatted:
(setq exit
  (if (> quantity 0)
   "door"
   "doors"))
[snip]





More information about the Python-list mailing list