Skip to main content

Python Trickery

Here are some bits of Python trickery that I have come across. Each of the following is invalid syntax. See if you can figure out why

1 + not(2)
f(*(
i for i in range(10)
if i % 2),
x=3,)

Comments

Comments powered by Disqus