For review: PEP 308 - If-then-else expression

Dan Schmidt dfan at dfan.org
Sat Feb 8 06:28:12 CET 2003


Carel Fellinger <carel.fellinger at chello.nl> writes:

| On Sat, Feb 08, 2003 at 04:38:13AM +0100, Carel Fellinger wrote:
| ...
| > The following looks better (even better were it to fit on one line:)
| > 
| >            else:                     # een westerse datum
| >                kind = "julian" if (self.reform == None or date < self.reform)
| >                       else "gregorian"
| >                self.query.append(#LETOP: amerikaanse volgorde maand dag, jaar
| >                    "(cf-dag (calendar-absolute-from-%s '(%d %g %d)))"
| >                    % (kind, date[1], date[2], date[0]))
| 
| Reminded by examples in other postings in this thread I realize that
| 
|                  kind = ["julian", "gregorian"][self.reform == None or
|                                                 date < self.reform)]
| 
| even looks better:)

It may look better, but it means the opposite.

-- 
http://www.dfan.org




More information about the Python-list mailing list