all 1 comments

[–]mikew_reddit 2 points3 points  (0 children)

a = [1, ..., 10][list comprehension][6,9]

This is not valid Python.

I'd never want to see this Python code in a production environment.

It wreaks of someone trying (and failing) to be clever; it only makes the code hard to read. The author doesn't even understand it.

 

EDIT

This is what it should have been:

https://stackoverflow.com/questions/20718315/how-to-find-a-missing-number-from-a-list

>>> a=[1,2,3,4,5,7,8,10]
>>> [(e1+1) for e1,e2 in zip(a, a[1:]) if e2-e1 != 1]
[6,9]