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

Point float arithmetic not mutable?! #1344

Open
xarthurx opened this issue Apr 29, 2024 · 2 comments
Open

Point float arithmetic not mutable?! #1344

xarthurx opened this issue Apr 29, 2024 · 2 comments

Comments

@xarthurx
Copy link

Describe the bug
The code means more than a thousand words:

>>> p1 = cg.Point(1.2, 4, 3)
>>> p1                           
Point(x=1.2, y=4.0, z=3.0)
>>> p1 * 0.5 
Point(x=0.6, y=2.0, z=1.5)
>>> 0.5 * p1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for *: 'float' and 'Point'

Expected behavior
No Errors

Desktop (please complete the following information):

  • OS: Win/Linux
  • Python version [e.g. 2.7]
  • Python package manager [e.g. macports, pip, conda]

Additional context
Is this by design?!

@gonzalocasas
Copy link
Member

This was discussed recently here #1248 (comment)

@xarthurx
Copy link
Author

xarthurx commented Apr 29, 2024

This was discussed recently here #1248 (comment)

OK. as one basic math operations, I DO think this is very necessary and common...
If you don't support sth like this, I would recommend it should be highlighted in the documentation...

Based on my experience, people may prefer to put the float in front, especially when you compute a

"WEIGHTED * long-expression"

@Licini Licini mentioned this issue Apr 29, 2024
10 tasks
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

No branches or pull requests

2 participants