# Association key names and optional argument names

**URL:** <https://community.wolfram.com/t/association-key-names-and-optional-argument-names/17212>\
**Category:** Questions\
**Created:** [December 17, 2020, 3:57pm UTC](https://community.wolfram.com/t/association-key-names-and-optional-argument-names/17212 "2020-12-17T15:57:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tjpstewart38](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/tjpstewart38/32/8883_2.png) [@tjpstewart38](https://community.wolfram.com/u/tjpstewart38)\
**Post date:** [December 17, 2020, 3:57pm UTC](https://community.wolfram.com/t/association-key-names-and-optional-argument-names/17212/1 "2020-12-17T15:57:14Z")

</div>

Is there a standard practice for choosing key names?  
I come from a Python background where these names are not subject to replacement (that is, they are not part of a global name space). But, in the Wolfram Language I find that they are. So, I feel that there are two choices:

1 Use Strings as key names

2 Use any name and Protect it

But, most of the examples I see in the documentation show using any name (abc-\>True) where, presumably, you would not want to have abc be subject to substitution due to some prior (or later) assignment expression (abc=3).

I had started the practice of using key names starting with a dollar sign ($abc-\>True) and Protecting those names. That way I wasn’t arbitrarily Protecting names (like abc) thus preventing (or interfering with) there use.

I am new to Wolfram Language so any insights would be appreciated.

---

<div class="post-metadata">

**Author:** ![jasonb](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/jasonb/32/20741_2.png) [@jasonb](https://community.wolfram.com/u/jasonb)\
**Post date:** [December 17, 2020, 9:00pm UTC](https://community.wolfram.com/t/association-key-names-and-optional-argument-names/17212/2 "2020-12-17T21:00:01Z")

</div>

In almost all situations I use strings as key names in an `Association`.

---

<div class="post-metadata">

**Author:** ![henrikschachner](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/henrikschachner/32/32119_2.png) [@henrikschachner](https://community.wolfram.com/u/henrikschachner)\
**Post date:** [December 17, 2020, 11:10pm UTC](https://community.wolfram.com/t/association-key-names-and-optional-argument-names/17212/3 "2020-12-17T23:10:33Z")

</div>

Here is just a remark: There are [_ **Formal Symbols** _](https://reference.wolfram.com/language/tutorial/MathematicalAndOtherNotation.html#173509264) (denoted by a single point below the symbol) which are protected _per se_, i.e. one cannot assign a value. Sometimes this can be quite useful. But yes: As key names strings can have advantages, e.g. when using lookups (see documentation about `Association`):

> The explicit Key can be omitted when the keys are strings …

---

<div class="post-metadata">

**Author:** ![tjpstewart38](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/tjpstewart38/32/8883_2.png) [@tjpstewart38](https://community.wolfram.com/u/tjpstewart38)\
**Post date:** [December 18, 2020, 12:39am UTC](https://community.wolfram.com/t/association-key-names-and-optional-argument-names/17212/4 "2020-12-18T00:39:20Z")

</div>

Thanks to both Jason and Henrik for your replies. They were helpful.
