What a fascinating newbie confusion! It surprised and tickled me. FYI, in Icon this kind of thing "just works". e1 | e2 | ... | en is "a generator" there too, and acts like the Python def g(): for x in e1: yield x for x in e2: yield x ... for x in en: yield en Then the expression y1 == y2 generates the cross-product of the y1 and y2 sequences, succeeding in the end iff some pair of generated values compares equal. No, I'm not suggesting Python do that too <wink>. It's more in the way of noting that no matter *how* odd a question looks to you, some peoples' brains are so wired that it's hard for them to view it otherwise. finally-understanding-vi-users<wink>-ly y'rs - tim -----Original Message----- From: python-list-admin@python.org Sent: Wednesday, August 08, 2001 1:26 PM To: python-list@python.org Subject: if-else with '|' operator - beginner's question/problem Hi there, I wonder if someone could possibly tell me what is wrong with the following statement. I'm extremely embarrased to ask but here goes... >>> if (fname[1] == 'a'|'e'|'i'|'o'|'u'): vowel='true' Traceback (innermost last): File "<pyshell#46>", line 1, in ? if (fname[1] == 'a'|'e'|'i'|'o'|'u'): TypeError: bad operand type(s) for | --- fname[1] gives 'e' Thanks very much in advance! Lee -- http://mail.python.org/mailman/listinfo/python-list
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4