Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2708
| From | Blockheads Oi Oi <breamoreboy@yahoo.co.uk> |
|---|---|
| Subject | Re: TypeError: iterable argument required |
| Date | 2011-04-06 17:12 +0100 |
| References | <27163982-380f-4ddd-859e-adc069892c28@glegroupsg2000goo.googlegroups.com> <899d22f6-c936-4fe6-b824-4d064281ca54@o26g2000vby.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.77.1302106354.9059.python-list@python.org> (permalink) |
On 06/04/2011 16:57, Νικόλαος Κούρας wrote: >>>> mail = None >>>> mail = mail or 7 >>>> mail > 7 > >>>> mail = None >>>> mail = 7 or mail >>>> mail > 7 > > Here no matter the order iam writing the comparison it always return > the number. > > why not the same here? > >>>> mail = None >>>> mail = mail or '' >>>> mail > '' > >>>> mail = None >>>> mail = '' or mail >>>> mail >>>> > > Why the or operator behaves differently with numbers than from > strings? > > Please explain to me how it parses it with words. > > Thank you. See this for an explanation of Python truth value testing. http://docs.python.org/library/stdtypes.html Cheers. Mark L.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: TypeError: iterable argument required "eryksun ()" <eryksun@gmail.com> - 2011-04-06 06:54 -0700
Re: TypeError: iterable argument required Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2011-04-06 08:41 -0700
Re: TypeError: iterable argument required Νικόλαος Κούρας <nikos.kouras@gmail.com> - 2011-04-06 08:57 -0700
Re: TypeError: iterable argument required Blockheads Oi Oi <breamoreboy@yahoo.co.uk> - 2011-04-06 17:12 +0100
csiph-web