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

Create Point3d from tuple and list. #124

Merged
merged 3 commits into from
May 26, 2024
Merged

Create Point3d from tuple and list. #124

merged 3 commits into from
May 26, 2024

Conversation

rodja
Copy link
Member

@rodja rodja commented May 25, 2024

This PR adds two helpful builder functions to the Point3d class.

@rodja rodja added the enhancement New feature or request label May 25, 2024
@rodja rodja added this to the 0.10.9 milestone May 25, 2024
@rodja rodja requested a review from falkoschindler May 25, 2024 10:56
Copy link
Contributor

@falkoschindler falkoschindler left a comment

Choose a reason for hiding this comment

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

What do you think about this alternative?

@staticmethod
def from_sequence(seq: Sequence[float]) -> Point3d:
    return Point3d(x=seq[0], y=seq[1], z=seq[2])

I'm not too sure about the name from_sequence. But we could call it from_tuple (referring to the already existing tuple property) and accept a Sequence[float], so that you can use it for tuples and lists.

@rodja
Copy link
Member Author

rodja commented May 26, 2024

@falkoschindler I like the idea to consolidate the factory with Sequence. I've also added a docstring. Ready to merge?

@falkoschindler falkoschindler merged commit 5ac5555 into main May 26, 2024
3 checks passed
@falkoschindler falkoschindler deleted the point3d branch May 26, 2024 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants