Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #85423
| Path | csiph.com!usenet.pasdenom.info!news.franciliens.net!fdn.fr!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <davea@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.058 |
| X-Spam-Evidence | '*H*': 0.89; '*S*': 0.00; 'say,': 0.05; 'context': 0.07; 'instance.': 0.09; 'python': 0.11; 'stored': 0.12; "'n'": 0.16; 'attr': 0.16; 'binding.': 0.16; 'c++.': 0.16; 'simplest': 0.16; 'try?': 0.16; 'wrote:': 0.18; 'version.': 0.19; 'written': 0.21; 'import': 0.22; 'header:User-Agent:1': 0.23; 'file.': 0.24; 'class.': 0.26; 'define': 0.26; 'defined': 0.27; 'header:In-Reply- To:1': 0.27; 'node': 0.31; 'seemingly': 0.31; 'class': 0.32; 'url:python': 0.33; 'style': 0.33; 'tool': 0.35; 'but': 0.35; 'there': 0.35; 'url:org': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'little': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'skip:u 10': 0.60; 'tell': 0.60; 'new': 0.61; 'url:3': 0.61; 'skip:n 10': 0.64; 'telling': 0.64; 'charset:windows-1252': 0.65; 'received:74.208': 0.68; 'url:4': 0.69; 'received:74.208.4.194': 0.84; 'slots.': 0.84; 'url:datamodel': 0.84; 'url:reference': 0.84; 'simulation': 0.91 |
| Date | Mon, 09 Feb 2015 22:12:01 -0500 |
| From | Dave Angel <davea@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Weird behavior on __dict__ attr |
| References | <20150210025243.GB1266@FuzzyHorror> |
| In-Reply-To | <20150210025243.GB1266@FuzzyHorror> |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:LV1nK0lkdV7iPkHIsOn46diM+DHS4+opU96+K+ex2KW DeNfHRNxfuX4LEhszcknP8RRvE9p4f6rCA1DhrYxB6zHgaD+0D OLYcyVSNyq/qHY1osqi7hD22JgACvgaQwOogLuirhwO3sWdaFW zIzVk1NOZ1hiQbX6Mz0ZJuOQPv1CY/hIklyUA2Ztw5sMbQsO0b eWSyaFB8tphbFg7Ili7dWjctwx5oksXUxuGaHyn/fSc/3kE+fh UYK7BkoQgeTboUr5VRP9vaygZbIgutSgxO5CgQNUnZt0Op9pyl Rx59laPilOTC6AUDTUOzhxn4KNhkqQiCb3mq67+Yzgo+emgBCc heIlxOG8LEJdYYe/aRkY= |
| X-UI-Out-Filterresults | notjunk:1; |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18591.1423537938.18130.python-list@python.org> (permalink) |
| Lines | 47 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1423537938 news.xs4all.nl 2852 [2001:888:2000:d::a6]:58248 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:85423 |
Show key headers only | View raw
On 02/09/2015 09:52 PM, Shiyao Ma wrote: > Hi. > > My context is a little hard to reproduce. WHY don't you try? Telling us about a class without showing how it's defined leaves us all guessing. Start by telling us Python version. And if it's 2.x, tell us whether this class is an old style or new style class. > > 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? > Lots of possibilities. Simplest is slots. if you define __slots__, then there's no dictionary in each instance. https://docs.python.org/3.4/reference/datamodel.html#slots -- DaveA
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Weird behavior on __dict__ attr Dave Angel <davea@davea.name> - 2015-02-09 22:12 -0500
csiph-web