[Python-Dev] statement vs expression [was: (try-except) conditional expression similar to (if-else) conditional (PEP 308)] (original) (raw)
Jim Jewett jimjjewett at gmail.com
Mon Aug 10 02:55:12 CEST 2009
- Previous message: [Python-Dev] hi everyone
- Next message: [Python-Dev] codecs.oen [was: PEP 385: the eol-type issue]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Kristján Valur Jónsson wrote:
I've never understood the need to have a distinction betwen statements and expressions, not when expressions can have side effects.
Alex Martelli responded:
If you're interested in understanding it better, research Query-Command Separation (QCS), e.g. starting at http://en.wikipedia.org/wiki/Command-queryseparation
Either you missed Kristján's point, or your answer was so subtle that I missed yours.
QCS makes it easy to determine which pieces of code (queries) are free of side-effects. I see value in that for both debugging and optimization.
What I don't see is how that relates to expressions vs statements when expressions can have side effects.
(Actually, in Python, I would say that statements are far more likely to be free of side-effects, as they are often there for flow control.)
-jJ
- Previous message: [Python-Dev] hi everyone
- Next message: [Python-Dev] codecs.oen [was: PEP 385: the eol-type issue]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]