On Mon, Nov 24, 2014 at 5:28 AM, Ron Adam <ron3200 at gmail.com> wrote: > With the passage of the PEP, it will change what is different about them > once it's in full effect. The stop hack won't work in both, and you may get > a RuntimeError in generator expressions where you would get StopIteration in > list-comps. (Is this correct?) "them" being list comps and generator expressions? The stop hack won't work in either (currently it does work in genexps), but you'd get a different exception type if you attempt it. This is correct. It's broadly similar to this distinction: >>> {1:2,3:4}[50] Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyError: 50 >>> [1,2,3,4][50] Traceback (most recent call last): File "<stdin>", line 1, in <module> IndexError: list index out of range In both lists and dicts, you can't look up something that isn't there. But you get a slightly different exception type (granted, these two do have a common superclass) depending on the exact context. But the behaviour will be effectively the same. ChrisA
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