detmining name during an assignment

Jamie Riotto jamie.riotto at gmail.com
Fri Sep 18 13:00:28 EDT 2009


I have an app that uses Python scripting. When a user creates a new object:

objName = newObject()

I'd like the newObject be able to use objName as its internal name.
So, if a user says:

cube1 = Cube()

 A "cube1" object should apear in the scene list. I believe this means I need
to determine that a namespace assignment is going on from inside the
object's init code
or by using properties.

I've searched the web but can't find a simple answer. Is there some
way to use the inspect
module get source code functoins? How would I get the code for "the
current interpreter line"
causing the init code to execute?

Thanks very much in advance,
Jamie Riotto



More information about the Python-list mailing list