Weird behavior on __dict__ attr
Shiyao Ma
i at introo.me
Mon Feb 9 21:52:43 EST 2015
Hi.
My context is a little hard to reproduce.
NS3 is a network simulation tool written in C++. I am using its Python binding.
So the class I am dealing with is from a .so file.
Say, I do the following:
%
import ns.network.Node as Node
# Node is a class
# it has a __dict__ attr
# Now I instantiate an instance of Node
n = Node()
# I checked, there is no __dict__ on 'n'
# but the following succeeds.
n.foobar = 3
My understanding is the foobar is stored in n.__dict__, but seemingly n has no __dict__.
So where does the foobar go?
TIA.
--
Shiyao Ma
http://introo.me
More information about the Python-list
mailing list