I am trying to initialize the variables to zero, so currently it looks like
x1,y1,x2,y2=(0,0,0,0)
It works, but just seems a little redundant. Is there a cleaner way?
I usually did
x1 = y1 = x2 = y2 = 0
However, this is hardly relevant. Both versions are easy to understand at a glance.
This effectively unpacks the tuple. You can do:
Just don't do this with mutable objects!
I personally used Jon or Sven for descriptive itertools , but as an alternative answer you can use itertools for this:
itertools
import itertools x1,y1,x2,y2 = itertools.repeat(0,4)
Warning about mutable objects is still applied!