This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients mark.dickinson, rhettinger, skrah, steven.daprano, tim.peters
Date 2018-03-17.00:27:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The obvious work-around of calling hypot multiple times is not only tedious, but it loses precision. For example, the body diagonal through a 1x1x1 cube should be √3 exactly:

py> from math import hypot, sqrt
py> hypot(hypot(1, 1), 1) == sqrt(3)

I know of at least five languages or toolkits which support this feature, or something close to it: Javascript, Julia, Matlab, GNU Scientific Library, and C++.

Javascript and Julia support arbitrary numbers of arguments:

Using Firefox's javascript console, I get the correct body diagonal for the cube:

>> Math.hypot(1, 1, 1) == Math.sqrt(3)

Matlab's hypot() function only takes two arguments, but norm(vector) returns the Euclidean 2-norm of the vector, i.e. equivalent to the hypot of multiple arguments.

The GNU Scientific Library and C++ support a three-argument form of hypot:

So +1 on math.hypot supporting arbitrary number of arguments.
Date User Action Args
2018-03-17 00:27:53steven.dapranosetrecipients: + steven.daprano, tim.peters, rhettinger, mark.dickinson, skrah
2018-03-17 00:27:53steven.dapranosetmessageid: <>
2018-03-17 00:27:53steven.dapranolinkissue33089 messages
2018-03-17 00:27:53steven.dapranocreate