Sure, I agree. In Python, that small time to initialize the data to zero is nothing, and it’s well worth the cost in order to avoid user confusion.
But there are other non-Pythonic aspects of Panda, things that can lead to similar confusions. The fact that Vec3.zero() can’t be modified is weird to Python users. The fact that if you let go of your Actor pointer, the actor stops playing is weird. The fact that if you find an Actor out of the scene graph you just get back a regular NodePath is weird. The fact that you can’t pass parameters by keyword to most Panda calls is weird. The fact that you can overload parameters with different kinds of arguments, and get different behaviors, is weird.
The list goes on. All of these non-Pythonic aspects, require a certain amount of user familiarity to learn the rules. They all exist because, frankly, Panda is not written in Python. It’s written in C++, and we’ve done a pretty good job of bolting it seamlessly to Python, but when you scratch the surface you can’t help but discover the C++ nature of it underneath, and some of these things have no good answer other than “you have to do it that way”.
In this particular case, we do need to have the default constructor perform no initialization–that’s very important for the low-level C++ performance.
But there’s no easy way to make the default constructor do one thing in Python, and something different in C++. (It could be done, but we’d have to shadow the constructor in Python, which would be likely to lead to greater user confusion down the line.)
However, it is possible to hide the default constructor from Python, so that Python programmers will no longer be able to call it at all–they’ll always have to use Vec3(0) or some other variant to create a new Vec3. Unfortunately, when I tried to do this, I immediately ran into a problem: there’s too much existing Python code that just creates a Vec3() on the fly (and then immediately initializes it, properly). If I made this change, all of this existing code would suddenly stop working.
At the end of the day, my conclusion was: we might be best off leaving it the way it is. New programmers learning Panda will come across this issue from time to time, and quickly learn that Vec3() is not necessarily zero. Add it to the list of things people must learn. It should be pointed out in the manual, of course, but we don’t really have a manual chapter that talks about the math libraries yet.
Note that this exact same issue has come up before: https://discourse.panda3d.org/viewtopic.php?t=2769
David