python / cpython

The Python programming language
https://www.python.org
Other
63.15k stars 30.24k forks source link

Let math.dist() accept coordinates as sequences #81872

Closed rhettinger closed 5 years ago

rhettinger commented 5 years ago
BPO 37691
Nosy @tim-one, @rhettinger, @mdickinson
PRs
  • python/cpython#14975
  • python/cpython#14984
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields: ```python assignee = 'https://github.com/rhettinger' closed_at = created_at = labels = ['3.8', 'library', '3.9'] title = 'Let math.dist() accept coordinates as sequences' updated_at = user = 'https://github.com/rhettinger' ``` bugs.python.org fields: ```python activity = actor = 'rhettinger' assignee = 'rhettinger' closed = True closed_date = closer = 'rhettinger' components = ['Library (Lib)'] creation = creator = 'rhettinger' dependencies = [] files = [] hgrepos = [] issue_num = 37691 keywords = ['patch'] message_count = 3.0 messages = ['348541', '348565', '348566'] nosy_count = 3.0 nosy_names = ['tim.peters', 'rhettinger', 'mark.dickinson'] pr_nums = ['14975', '14984'] priority = 'normal' resolution = 'fixed' stage = 'resolved' status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue37691' versions = ['Python 3.8', 'Python 3.9'] ```

    rhettinger commented 5 years ago

    I did some user testing with Python 3.8 and found that math.dist() was a little restrictive in only accepting coordinates as tuples. Mostly it worked out fine except but was a little inconvenient with generalized unpacking:

    label, *coordinates = cursor.fetchone() # coordinates is a list

    Also, it would be nice to allow numpy arrays as arguments.

    rhettinger commented 5 years ago

    New changeset 6b5f1b496f0b20144592b640b9c975df43a29eb0 by Raymond Hettinger in branch 'master': bpo-37691: Let math.dist() accept sequences and iterables for coordinates (GH-14975) https://github.com/python/cpython/commit/6b5f1b496f0b20144592b640b9c975df43a29eb0

    rhettinger commented 5 years ago

    New changeset 76821bab9cb77fa7f847e66f8b2309ca30546c7f by Raymond Hettinger (Miss Islington (bot)) in branch '3.8': bpo-37691: Let math.dist() accept sequences and iterables for coordinates (GH-14975) (GH-14984) https://github.com/python/cpython/commit/76821bab9cb77fa7f847e66f8b2309ca30546c7f