Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85421
| Date | 2015-02-10 10:52 +0800 |
|---|---|
| From | Shiyao Ma <i@introo.me> |
| Subject | Weird behavior on __dict__ attr |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18589.1423536776.18130.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Weird behavior on __dict__ attr Shiyao Ma <i@introo.me> - 2015-02-10 10:52 +0800 Re: Weird behavior on __dict__ attr Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-02-10 19:00 +1100
csiph-web