- def __new__(cls, coordinates=None):
- if isinstance(coordinates, Mapping):
- coordinates = coordinates.items()
- self = object().__new__(cls)
- self._coordinates = OrderedDict()
- for symbol, coordinate in sorted(coordinates,
- key=lambda item: item[0].sortkey()):
- if not isinstance(symbol, Symbol):
- raise TypeError('symbols must be Symbol instances')
- if not isinstance(coordinate, numbers.Real):
- raise TypeError('coordinates must be real numbers')
- self._coordinates[symbol] = coordinate
- return self
-