[Python-Dev] "and" and "or" operators in Py3.0
Aahz
aahz at pythoncraft.com
Tue Sep 20 05:57:38 CEST 2005
More information about the Python-Dev mailing list
Tue Sep 20 05:57:38 CEST 2005
- Previous message: [Python-Dev] "and" and "or" operators in Py3.0
- Next message: [Python-Dev] "and" and "or" operators in Py3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Sep 19, 2005, Jonathan LaCour wrote: > Raymond Hettinger: >> >> P.S. Simplifying "and" and "or" may create a need to introduce a >> conditional operator but that is a discussion for another day. > > While I don't disagree with some of your main points, I do think that > your proposal would eliminate a natural and easy to understand use of > the current behavior of "or" that I tend to use quite a bit. Your > proposal would break a lot of code, and I can't think of a better > "conditional operator" than the one thats already there. > > I often find myself using 'or' to conditionally select a meaningful > value in the absence of a real value: > > person = Person.fetch(id=5) > name = person.name or 'John Doe' > birth_date = person.birth_date or '00-00-0000' > ssn = person.social_security or 'not provided' While I'm in philosophical agreement with Raymond, it's also true that my current company's code is littered with constructs like yours. So I have to say that it would break too much code. -- Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/ The way to build large Python applications is to componentize and loosely-couple the hell out of everything.
- Previous message: [Python-Dev] "and" and "or" operators in Py3.0
- Next message: [Python-Dev] "and" and "or" operators in Py3.0
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list