# How access UserDictionary in Python?

**URL:** <https://discourse.mcneel.com/t/how-access-userdictionary-in-python/42267>\
**Category:** Scripting\
**Tags:** python\
**Created:** [March 16, 2017, 12:18pm UTC](https://discourse.mcneel.com/t/how-access-userdictionary-in-python/42267 "2017-03-16T12:18:25Z")\
**Posts on this page:** 1\
**Showing post:** 19

<div class="post-metadata">

**Author:** ![RIL](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/ril/32/771758_2.png) [@RIL](https://discourse.mcneel.com/u/RIL)\
**Post date:** [March 17, 2017, 12:34pm UTC](https://discourse.mcneel.com/t/how-access-userdictionary-in-python/42267/19 "2017-03-17T12:34:56Z")

</div>

My favorite example of interpreting UML class diagrams in the picture below.

**All about Types**  
Notice that the diagram shows two (2) ways to define “type”. The traditional Object Oriented (OO) Inheritance way (Male and Female classes descending from “Human”) and the more flexible GenderType-link to a, well, a GenderType (_more advanced both technically and conceptually because it also allows changing the gender, and to add any number of “genders”… 🙂_ ).

**Hierarchy**  
Anyway, since OOP involves “inheritance” I think that an example of Kind (Class Humans) as opposed to Generations (depicted by children & parents) helps the mind to find the best way to define different kinds of hierarchies.

**Interface** - The _Interface_ type is not included here, only Classes, Attributes and Relations, but _Interfaces_ are simply “injected” to classes with a pin symbol with a round pin head.

**Ownership Links** - Notice the difference between filled and unfilled _diamond_ symbols for certain relations :

- **Filled diamonds** (black) can be perceived as “owns” and code generators typically injects code to auto-create such related objects On Create of the owning class (and also destroyed together with the owning object)
- **Unfilled diamonds** can be perceived as “has”. A “has”-relation can be dropped, or reconfigured to refer to some other object instance as opposed to “owns” which live and die with the owner object.

**Configurable Type** - The “advanced” `GenderType` kind of type-concept (shown far below in the picture) is often used in other contexts, so never mind the concept of gender, it just goes well together with human inheritance and relations etc.

**Roles** - Notice also the direction from which you read the link-roles (“wife” is technically an attribute of Male and “husband” is an attribute of “Female” etc).

 ![](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/8/7/87ddd97c5ae1e3e1bd164fcf986f65b3ee3401a5.png)

There are a few more other UML notations not shown here, but this is the basic stuff that makes most sense for a start.

Edit: Notice also that using inheritance for defining Male & Female in software is _ **not** _ recommended (but for explaining the technical OO concept of inheritance it is useful). One reason for not using inheritance for gender is that the sequence of events for gaining the information may require that you create a “Person” or “Human” object first, and only after that you will learn about the gender, and so it’s more convenient to just create the Person class and assign the GenderType-link only when that info is known.

// Rolf

---

_[View the full topic](https://discourse.mcneel.com/t/how-access-userdictionary-in-python/42267)._
