### 7.1. `Pt.__init__()`: Constructor

To allow the user the flexibility to provide either two arguments or one argument containing two values, we use the Python convention for a method with a variable number of arguments.

homcoord.py
```# - - -   P t . _ _ i n i t _ _

def __init__ ( self, *args ):
'''Constructor.
'''
#-- 1 --
# [ if args has one element containing exactly two values ->
#     x  :=  args[0][0]
#     y  :=  args[0][1]
#     w  :=  1.0
#   else if args has one element containing three values ->
#     x  :=  args[0][0]
#     y  :=  args[0][1]
#     w  :=  args[0][2]
#   else if args has exactly two values ->
#     x  :=  args[0]
#     y  :=  args[1]
#     w  :=  1.0
#   else -> raise ValueError ]
if len(args) == 1:
value = args[0]
if len(value) == 2:
x, y = value
w = 1.0
else:
x, y, w = value
else:
x, y = args
w = 1.0
```

Form the 3-element vector by adding a third element equal to 1. The “`dtype=float_`” forces floating point representation, even if the provided values were integers.

homcoord.py
```        #-- 2 --
# [ self.v  :=  a 3-element numpy vector (x, y, w) as
#                 type float
#   self.__inverse  :=  None ]
self.v = num.array ( (x, y, w), dtype=num.float_ )
```