__builtins__?

I’m wondering if there is any plan to eventually modify the way panda3d does its builtins magic… I’ve found a post from a while back, but it’s pre-1.6, and a bit of a hack (here)

There’s a huge, obvious API incompatibility if suddenly people are required to explicitly import things like base, loader, and render, so it couldn’t possibly be a change that happens in the 1.x series. Quite literally, every single panda3d application would cease to function unless modified to import those items. Big ouch.

In an application composed of many source files, it’s fairly confusing to know which python module to import to get access to base. Each time I have to stop and think, and all I can ever do is refer to an example of somebody’s working code, sicne there is no explicit ability to make the import.

In a multi-file setup, it’s frankly awkward to have to import ShowBase in a random file just to get base, and then never use ShowBase at all. If an explicit import were possible, this would have the benefit of better code readability. I personally find it quite distasteful and poorly styled to leverage the builtins in this way. It feels like there isn’t really a good reason why builtins are used as opposed to just making these things normal locals available for import.

Is it possible to make some simple change in the panda3d code to allow for explicit imports of these magic builtins? This would allow for more obvious import statements, and could possibly reduce the amount of stuff that triggers when a broad import of ShowBase happens.

I’ve easily found several weird ways to have a multiple-file game structured, where I have to do shameless imports of ShowBase for little reason other than to allow that file to set the game window resolution, etc.

Any hope for an official change?

I’ve attempted to change this in the source code, but it’s a fool’s errand. Too much code (within Panda3D, too) depends on them, it’s almost impossible to change everything while keeping it working.

For Panda3D 2, however, we plan on having this nuisance removed.