code: def _set_type(self, newType):
          
          oldType = self.type
          if oldType == newType:
              return
          contour = self.contour
          if contour is None:
              raise FontPartsError("The segment does not belong to a contour.")
          # converting line <-> move
          if newType in ("move", "line") and oldType in ("move", "line"):
              pass
          # converting to a move or line
          elif newType not in ("curve", "qcurve"):
              offCurves = self.offCurve
              for point in offCurves:
                  contour.removePoint(point)
          # converting a line/move to a curve/qcurve
          else:
              segments = contour.segments
              i = segments.index(self)
              prev = segments[i - 1].onCurve
              on = self.onCurve
              x = on.x
              y = on.y
              points = contour.points
              i = points.index(on)
              contour.insertPoint(i, (x, y), "offcurve")
              off2 = contour.points[i]
              contour.insertPoint(i, (prev.x, prev.y), "offcurve")
              off1 = contour.points[i]
              del self._points
              self._setPoints((off1, off2, on))
          self.onCurve.type = newType
docs: Subclasses may override this method.