<br><br><div class="gmail_quote">On 5 November 2010 00:40, Mac Ryan <span dir="ltr">&lt;<a href="mailto:quasipedia@gmail.com">quasipedia@gmail.com</a>&gt;</span> wrote: <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div class="h5">
</div></div>Thank you Walter. I got it and it works! :)<br></blockquote><div><br>Excellent.  I thought I&#39;d mention here you can also create your own Namespace object (e.g. if you find accessing __dict__ not ideal or something you can do your own implementation, which will work as long as it&#39;s got the neccesary features.)<br>
 </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I had previously already inspected &quot;ns.__dict__&quot; with the &quot;dir()&quot;<br>
function, but couldn&#39;t (and can not) see my parameters neither with<br>
&quot;dir(ns.__dict__)&quot; nor with &quot;dir(ns.__dict__.items)&quot;. This is clearly an<br>
indication that I misunderstand what the __dict__ is and how it works.<br></blockquote><div><br>You need to distinguish between what __dict__ *is*, and what it *contains*.  dir() does introspection, it inspects what an object in Python *is*, e.g. displays all the methods and attributes of the object.  It does not however know anything about what (if anything) the object might contain, in the data storage sense. <br>
<br>A dictionary object is a specific type of container object, it has many methods but suffice it to say the data (keys and values) inside it are obviously not explicitly exposed as attribues of the dict object itself. So then, dir() on a dict object, shows you the methods and attributes of dict&#39;s, but nothing of what data might be inside the dict.<br>
<br>Similarly when you dir() your own instance of an object with some custom attributes, then likewise, dir() on the object itself will show you the members and attribues of that object itself. <br><br>Now, Python makes available a read-only, &quot;hidden&quot; attribute on all objects (e.g. a chiled member/object) called &quot;__dict__&quot;, into which it encodes the actual attributes of that object, as key value pairs.  So... if you dir() the object *itself*, you get information about *its* attributes, if you however dir() the dict that&#39;s part of that object, you&#39;ll get a dict&#39;s properties, not what is contained inside of the dicts.<br>
<br>Best,<br><br>Walter<br><br></div></div><br>