twk Posted February 16, 2016 Share Posted February 16, 2016 Greetings Pythonistas How do you guys go about with Vector types in python? I understand VS had a native Vector type in python and multiplying/dividing? or adding/subtracting could be done directly in VS without external functions. Am I right to assume that this is not the case for python? That adding/multiplying/etc two vectors would require a custom/external function? eg v1 = (1, 4) v2 = (4, 9) #v1 * v2 would not work #you'd need a custom function? def vector_multiply(vec1, vec2): DP = (vec1[0]*vec2[0], vec1[1]*vec2[1]) return DP Quote Link to comment
Dieter @ DWorks Posted February 17, 2016 Share Posted February 17, 2016 Python doesn't have vectors natively, but there are classes out there for you to use, like for example: https://gist.github.com/mcleonard/5351452 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.