|
def length_2d(self) -> Optional[float]: |
|
""" |
|
Computes 2-dimensional length (meters) of segment (only latitude and |
|
longitude, no elevation). |
|
|
|
Returns |
|
---------- |
|
length : float |
|
Length returned in meters |
|
""" |
|
return mod_geo.length_2d(self.points) # type: ignore |
|
|
|
def length_3d(self) -> float: |
|
""" |
|
Computes 3-dimensional length of segment (latitude, longitude, and |
|
elevation). |
|
|
|
Returns |
|
---------- |
|
length : float |
|
Length returned in meters |
|
""" |
|
return mod_geo.length_3d(self.points) # type: ignore |
Why is length_2d marked as returning Optional[float]?
length_3d does not. GPXTrack and GPX's versions of length_2d are marked as plain float.
Is this a typings bug? Logic didn't seem to suggest that None is possible.
gpxpy/gpxpy/gpx.py
Lines 755 to 777 in 09fc46b
Why is
length_2dmarked as returningOptional[float]?length_3ddoes not.GPXTrackandGPX's versions oflength_2dare marked as plainfloat.Is this a typings bug? Logic didn't seem to suggest that
Noneis possible.