'Return the distance from the turtle to (x,y) in turtle step units.
Arguments:
x -- a number   or  a pair/vector of numbers   or   a turtle instance
y -- a number       None                            None
call: distance(x, y)         # two coordinates
--or: distance((x, y))       # a pair (tuple) of coordinates
--or: distance(vec)          # e.g. as returned by pos()
--or: distance(mypen)        # where mypen is another turtle
Example (for a Turtle instance named turtle):
>>> turtle.pos()
(0.00, 0.00)
>>> turtle.distance(30,40)
50.0
>>> pen = Turtle()
>>> pen.forward(77)
>>> turtle.distance(pen)
77.0'

def distance(self, x, y=None):

    if (y is not None):
        pos = Vec2D(x, y)
    if isinstance(x, Vec2D):
        pos = x
    elif isinstance(x, tuple):
        pos = Vec2D(*x)
    elif isinstance(x, TNavigator):
        pos = x._position
    return abs((pos - self._position))
