It does short circuit, your logic is just purposely fragile. If you reverse the variables it will print Empty, because the and statement evaluates left to right and stops if one of the arguments is falsey.
print(len(foo) > 0 and foo[0] or "Empty")
And since len can't give negative numbers the more Pythonic way to do it would be like this. Even though I generally prefer normal if blocks.
print(len(foo) and foo[0] or "Empty")
edit: I do agree that you should probably avoid doing this at all, because it is easy to introduce subtle bugs.
It does short circuit, your logic is just purposely fragile. If you reverse the variables it will print Empty, because the and statement evaluates left to right and stops if one of the arguments is falsey.
And since len can't give negative numbers the more Pythonic way to do it would be like this. Even though I generally prefer normal if blocks. edit: I do agree that you should probably avoid doing this at all, because it is easy to introduce subtle bugs.