For review: PEP 308 - If-then-else expression
Roman Suzi
rnd at onego.ru
Sun Feb 9 13:30:54 EST 2003
More information about the Python-list mailing list
Sun Feb 9 13:30:54 EST 2003
- Previous message (by thread): For review: PEP 308 - If-then-else expression
- Next message (by thread): For review: PEP 308 - If-then-else expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 8 Feb 2003, Paul Rubin wrote: >How about further abuse of colon: > > f(:expression) > >is short for f(lambda: expression) > >So we'd implement a conditional expression with > > def cond(condition, v1, v2): > if condition: > return v1() > else: > return v2() > >To call it, we'd say, for example, > > print cond(x >= 0, :sqrt(x), :"imaginary roots") Better to make ! equal to lambda ;-) print cond(x >= 0, !:sqrt(x), !:"imaginary roots") >I don't see immediately whether this makes any syntax ambiguities with >existing statements, since I can't think of anyplace where colon can >currently appear where an expression can also appear. > Sincerely yours, Roman Suzi -- rnd at onego.ru =\= My AI powered by Linux RedHat 7.3
- Previous message (by thread): For review: PEP 308 - If-then-else expression
- Next message (by thread): For review: PEP 308 - If-then-else expression
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list