On metric spaces and local extrema