3 added 2 characters in body

# Python 2

isSorted = lambda a: all(x>y for x,y in zip(a[1:],a[:-1]))
print isSorted( [(1+3j),(1+2j,),(2+1j)] )


The surplus comma after 1+2j does not raise a syntax error, because this is Python’s way of creating a tuple with one element. But most importantly, this avoids that in isSorted complex numbers are compared and thus a TypeError is raised. This is because apart from two complex numbers you can almost compare everything in Python, including complex numbers and tuples.

# Python

isSorted = lambda a: all(x>y for x,y in zip(a[1:],a[:-1]))
print isSorted( [(1+3j),(1+2j,),(2+1j)] )


The surplus comma after 1+2j does not raise a syntax error, because this is Python’s way of creating a tuple with one element. But most importantly, this avoids that in isSorted complex numbers are compared and thus a TypeError is raised. This is because apart from two complex numbers you can almost compare everything in Python, including complex numbers and tuples.

# Python 2

isSorted = lambda a: all(x>y for x,y in zip(a[1:],a[:-1]))
print isSorted( [(1+3j),(1+2j,),(2+1j)] )


The surplus comma after 1+2j does not raise a syntax error, because this is Python’s way of creating a tuple with one element. But most importantly, this avoids that in isSorted complex numbers are compared and thus a TypeError is raised. This is because apart from two complex numbers you can almost compare everything in Python, including complex numbers and tuples.

2 deleted 7 characters in body

# Python

isSorted = lambda a: all([ a[i]<=a[i+1]x>y for ix,y in range(lenzip(a)a[1:],a[:-11]) ])
print isSorted( [ (1+3j), (1+2j,), (2+1j) ] )


The surplus comma after 1+2j does not raise a syntax error, because this is Python’s way of creating a tuple with one element. But most importantly, this avoids that in isSorted complex numbers are compared and thus a TypeError is raised. This is because apart from two complex numbers you can almost compare everything in Python, including complex numbers and tuples.

# Python

isSorted = lambda a: all([ a[i]<=a[i+1] for i in range(len(a)-1) ])
isSorted( [ (1+3j), (1+2j,), (2+1j) ] )


The surplus comma after 1+2j does not raise a syntax error, because this is Python’s way of creating a tuple with one element. But most importantly, this avoids that in isSorted complex numbers are compared and thus a TypeError is raised. This is because apart from two complex numbers you can almost compare everything in Python, including complex numbers and tuples.

# Python

isSorted = lambda a: all(x>y for x,y in zip(a[1:],a[:-1]))
print isSorted( [(1+3j),(1+2j,),(2+1j)] )


The surplus comma after 1+2j does not raise a syntax error, because this is Python’s way of creating a tuple with one element. But most importantly, this avoids that in isSorted complex numbers are compared and thus a TypeError is raised. This is because apart from two complex numbers you can almost compare everything in Python, including complex numbers and tuples.

1

# Python

isSorted = lambda a: all([ a[i]<=a[i+1] for i in range(len(a)-1) ])
isSorted( [ (1+3j), (1+2j,), (2+1j) ] )


The surplus comma after 1+2j does not raise a syntax error, because this is Python’s way of creating a tuple with one element. But most importantly, this avoids that in isSorted complex numbers are compared and thus a TypeError is raised. This is because apart from two complex numbers you can almost compare everything in Python, including complex numbers and tuples.