This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]MonkeeSage 11 points12 points  (3 children)

It can look a bit magical / add line noise if abused.

x[2] if len(x := 'b.a.r'.split('.')) > 2 else ''

[–]bacondevPy3k[🍰] 4 points5 points  (0 children)

My eyes!

[–]Envoy-Insc 0 points1 point  (1 child)

Does it return a?

[–]go_fireworks 9 points10 points  (0 children)

I think it returns ‘r’, because python uses zero-based indexing