(self, *args)
Creates a rectangle.

        The corners of the rectangle can be specified by either a tuple
        (four items, two for each corner, respectively), four separate numbers
        (X and Y coordinates for each corner) or two separate numbers (width
        and height, the upper left corner is assumed to be at (0,0))
Creates a rectangle.
Creates a rectangle .
def __init__(self, *args):
        """Creates a rectangle.

        The corners of the rectangle can be specified by either a tuple
        (four items, two for each corner, respectively), four separate numbers
        (X and Y coordinates for each corner) or two separate numbers (width
        and height, the upper left corner is assumed to be at (0,0))"""
        coords = None
        if len(args) == 1:
            if isinstance(args[0], Rectangle):
                coords = args[0].coords
            elif len(args[0]) >= 4:
                coords = tuple(args[0])[0:4]
            elif len(args[0]) == 2:
                coords = (0, 0, args[0][0], args[0][1])
        elif len(args) == 4:
            coords = tuple(args)
        elif len(args) == 2:
            coords = (0, 0, args[0], args[1])
        if coords is None:
            raise ValueError("invalid coordinate format")

        try:
            coords = tuple(float(coord) for coord in coords)
        except ValueError:
            raise ValueError("invalid coordinate format, numbers expected")

        self.coords = coords
def __init__ ( self , * args ) : coords = None if len ( args ) == 1 : if isinstance ( args [ 0 ] , Rectangle ) : coords = args [ 0 ] . coords elif len ( args [ 0 ] ) >= 4 : coords = tuple ( args [ 0 ] ) [ 0 : 4 ] elif len ( args [ 0 ] ) == 2 : coords = ( 0 , 0 , args [ 0 ] [ 0 ] , args [ 0 ] [ 1 ] ) elif len ( args ) == 4 : coords = tuple ( args ) elif len ( args ) == 2 : coords = ( 0 , 0 , args [ 0 ] , args [ 1 ] ) if coords is None : raise ValueError ( "invalid coordinate format" ) try : coords = tuple ( float ( coord ) for coord in coords ) except ValueError : raise ValueError ( "invalid coordinate format, numbers expected" ) self . coords = coords