# SmartMaps In Scripting

**URL:** <https://forum.inductiveautomation.com/t/smartmaps-in-scripting/113262>\
**Category:** Ignition\
**Tags:** ignition81, scripting\
**Created:** [January 13, 2026, 6:25pm UTC](https://forum.inductiveautomation.com/t/smartmaps-in-scripting/113262 "2026-01-13T18:25:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xander\_Dawson-Fink](https://avatars.discourse-cdn.com/v4/letter/x/73ab20/32.png) [@Xander\_Dawson-Fink](https://forum.inductiveautomation.com/u/Xander_Dawson-Fink)\
**Post date:** [January 13, 2026, 6:25pm UTC](https://forum.inductiveautomation.com/t/smartmaps-in-scripting/113262/1 "2026-01-13T18:25:11Z")

</div>

So, I saw [a reply](https://forum.inductiveautomation.com/t/converting-dataset-tags-to-dictionaries-to-form-a-list-of-dicts/77571/25) (@pturmel’s reply, specifically) to a post that shows a SmartMap implementation. I’m not super familiar with Jython particularities. Do normal Jython dictionaries have some weird implementation that is worth fixing in the scripting world, and have I completely missed the use case for this? I feel like I’m missing something obvious, but I’m also a Java programmer coming to Jython, so there’s still Python oddities I’m figuring out.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 13, 2026, 6:34pm UTC](https://forum.inductiveautomation.com/t/smartmaps-in-scripting/113262/2 "2026-01-13T18:34:58Z")

</div>

The SmartMap class (found [here](https://www.automation-pros.com/ignition/smartmap.py)) exposes dictionary keys as attribute names, so that `someMap['key']` is equally accessible as `someMap.key`. Both for assignment and retrieval.

Excluding special attributes names starting with `_` and pre-defined dictionary method names, like `items()`.

Unfortunately, it can never be serialized, so I've largely replaced it with the [VarMap](https://www.automation-pros.com/toolkit/doc/scripting.html#varmap) class from my Integration Toolkit.

{Very similar to Perspective's ObjectWrapper, but usable everywhere.}

---

<div class="post-metadata">

**Author:** ![Xander\_Dawson-Fink](https://avatars.discourse-cdn.com/v4/letter/x/73ab20/32.png) [@Xander\_Dawson-Fink](https://forum.inductiveautomation.com/u/Xander_Dawson-Fink)\
**Post date:** [January 13, 2026, 7:28pm UTC](https://forum.inductiveautomation.com/t/smartmaps-in-scripting/113262/3 "2026-01-13T19:28:44Z")

</div>

Ah, ok. I thought I was missing something, but this is one of the oddities I know about in Jython, I think. It’s something like half the byte code to access a Jython attribute than go through the normal python routes (whether dict access or get/set function calls), so this would be more performant, right?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 13, 2026, 7:33pm UTC](https://forum.inductiveautomation.com/t/smartmaps-in-scripting/113262/4 "2026-01-13T19:33:44Z")

</div>

Attribute access isn't necessarily fewer opcodes. My original intent was to make code more readable.

But attribute access implemented in java (via `VarMap`) is a huge win over `SmartMap`'s override of ` __getattr__ `.

---

<div class="post-metadata">

**Author:** ![Xander\_Dawson-Fink](https://avatars.discourse-cdn.com/v4/letter/x/73ab20/32.png) [@Xander\_Dawson-Fink](https://forum.inductiveautomation.com/u/Xander_Dawson-Fink)\
**Post date:** [January 13, 2026, 7:36pm UTC](https://forum.inductiveautomation.com/t/smartmaps-in-scripting/113262/5 "2026-01-13T19:36:15Z")

</div>

Oh, ok. I conflated SmartMap and VarMap in that case. Code readability is always a win, nonetheless. Thank you for your explanation

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 13, 2026, 8:00pm UTC](https://forum.inductiveautomation.com/t/smartmaps-in-scripting/113262/6 "2026-01-13T20:00:06Z")

</div>

The one optimization that I always try to use in jython is the replacement of java `.getSomething()` with `.something`, as that eliminates the function invocation opcode.

---

<div class="post-metadata">

**Author:** ![Xander\_Dawson-Fink](https://avatars.discourse-cdn.com/v4/letter/x/73ab20/32.png) [@Xander\_Dawson-Fink](https://forum.inductiveautomation.com/u/Xander_Dawson-Fink)\
**Post date:** [January 13, 2026, 8:15pm UTC](https://forum.inductiveautomation.com/t/smartmaps-in-scripting/113262/7 "2026-01-13T20:15:56Z")

</div>

Yeah, that’s the pattern I had recognized, going from a function to attributes, but `dictionary[‘Something’]` doesn’t go through a function in the same way that `.getSomething()` does, so I went too far of a logical leap in my assumption that it must be more performant.
