[Python-Dev] Adding a conditional expression in Py3.0
Michael Hudson
mwh at python.net
Wed Sep 21 20:30:43 CEST 2005
More information about the Python-Dev mailing list
Wed Sep 21 20:30:43 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 ]
BJörn Lindqvist <bjourne at gmail.com> writes: >> My problem with this syntax is that it can be hard to read: >> >> return if self.arg is None then default else self.arg >> >> looks worryingly like >> >> return NAME NAME.NAME NAME NAME NAME NAME NAME NAME.NAME > > That can already be written in Python: No it can't! Would you believe I had this exact conversation two and a half years ago? :) > return self.arg or default Consider what happens if self.arg is 0, here. Cheers, mwh -- If I had wanted your website to make noise I would have licked my finger and rubbed it across the monitor. -- signature of "istartedi" on slashdot.org
- 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