Designing a Python API: list of coordinate tuples vs separate parameters?

1 week ago 6
ARTICLE AD BOX

I created a Python toolkit called `cartons` that wraps RoutingPy and OSRM. Currently, my API looks like this:

cartons.route(lon1, lat1, lon2, lat2)

For version 1.2.0, I want to support multiple waypoints and am considering changing it to:

cartons.route(coords_lon_lat)

Where coords is a list of tuples:

[(lon1, lat1), (lon2, lat2), (lon3, lat3)]

Is this a good and Pythonic design choice, or is there a better way to structure this?

Github Repo

Example: routing.py

from routingpy import OSRM def route(base_url, coords_lon_lat:list, transport): router = OSRM(base_url=base_url) route = router.directions( overview = "full", profile = transport, locations = coords_lon_lat ) return route
Read Entire Article