Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-33089: Add math.dist() for computing the Euclidean distance between two points #8561

Merged
merged 11 commits into from
Jul 31, 2018

Conversation

rhettinger
Copy link
Contributor

@rhettinger rhettinger commented Jul 30, 2018


}
diffs = (double *) PyObject_Malloc(n * sizeof(double));
if (diffs == NULL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Braces are required here (PEP7).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay.

diffs = (double *) PyObject_Malloc(n * sizeof(double));
if (diffs == NULL)
return NULL;
for (i=0 ; i<n ; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always put spaces around assignment, Boolean and comparison operators (PEP7).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Historically, we haven't done this inside for-loops.

result = 0.0;
goto done;
}
for (i=0 ; i<n ; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Always put spaces around assignment, Boolean and comparison operators (PEP7).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Historically, we haven't done this inside for-loops.

@rhettinger rhettinger merged commit 9c18b1a into python:master Jul 31, 2018
@LeonardAukea
Copy link

Hi, thanks for a great language. Not sure if this is the right place to add this comment. Anyways, was adding other norms ever under consideration? For instance, math.dist(p, q, norm='l1'), where euclidian or l2 would be default? I get that you may not want to add too many but at least the standard ones would be nifty.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants