Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70072
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: the logical operation confused me |
| Date | 2014-04-10 23:28 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <li79f8$6qp$4@dont-email.me> (permalink) |
| References | <mailman.9153.1397170954.18130.python-list@python.org> |
On Fri, 11 Apr 2014 07:02:33 +0800, length power wrote: >>>> "ok" or "not ok" > 'ok' >>>> "ok" and "not ok" > 'not ok' >>>> >>>> > why "ok" or "not ok" output "ok" , "ok" and "not ok" output "not ok" ? I believe that: [ (falsey condition) or ]* (first truthy condition) or (any condition) [ or (any condition) ]* will return (first truthy condition) whereas: (truthy condition) and [ (truthy condition) and ]* (last truthy condition) will return (last truthy condition) where "[ clause ]*" represents an optional clause that may be repeated any number of times, "any condition" may evaluate falsey or truthy, "first" and "last" relate to the position of the condition type in a left to right evaluation sequence. -- Denis McMahon, denismfmcmahon@gmail.com
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
the logical operation confused me length power <elearn2014@gmail.com> - 2014-04-11 07:02 +0800 Re: the logical operation confused me Denis McMahon <denismfmcmahon@gmail.com> - 2014-04-10 23:28 +0000
csiph-web