This question came from looking at this question on Stackoverflow.
def fringe8((px, py), (x1, y1, x2, y2)):
Personally, it's been one of my pet peeves to see a function that takes two arguments with fixed-number iterables (like a tuple) or two or more dictionaries (Like in the Shotgun API). It's just hard to use, because of all the verbosity and double-bracketed enclosures.
Wouldn't this be better:
>>> class Point(object):
... def __init__(self, x, y):
... self.x = x
... self.y = y
...
>>> class Rect(object):
... def __init__(self, x1, y1, x2, y2):
... self.x1 = x1
... self.y1 = y1
... self.x2 = x2
... self.y2 = y2
...
>>> def fringe8(point, rect):
... # ...
...
>>>
>>> point = Point(2, 2)
>>> rect = Rect(1, 1, 3, 3)
>>>
>>> fringe8(point, rect)
Is there a situation where taking two or more iterable arguments is justified? Obviously the standard itertools Python library needs that, but I can't see it being pretty in maintainable, flexible code design.