scikit-hep / vector

Vector classes and utilities
https://vector.readthedocs.io
BSD 3-Clause "New" or "Revised" License
77 stars 24 forks source link

Throw a useful error on implicit upcast if `ProjectClass*D` is not defined by a vector subclass #488

Open Saransh-cpp opened 1 month ago

Saransh-cpp commented 1 month ago

Is this a way to signal that there is no 4D interpretation of VertexArray? (which is true)

I can just remove L139, but vector would throw an error saying something like "ProjectionClass4D is not defined for VertexArray" if a user tries an operation that needs converting the array to a 4D vector. The error does not tell the user what they are doing wrong, but I am hoping that not a lot of users will try converting it to 4D?

I think it might make sense to raise an error if a user tries to write a code that requires implicit upcast from 3D point to 4D

_Originally posted by @nsmith- in https://github.com/CoffeaTeam/coffea/pull/991#discussion_r1670580026_