amazon-ion / ion-python

A Python implementation of Amazon Ion.
https://amazon-ion.github.io/ion-docs/
Apache License 2.0
260 stars 51 forks source link

Implement Symbol as Text in C-extension #327

Closed rmarrowstone closed 11 months ago

rmarrowstone commented 11 months ago

By default the IonPy value for a Symbol is IonPySymbol and the bare value is a SymbolToken. With the SYMBOL_AS_TEXT flag set, the IonPy value for a Symbol is IonPyText, and the bare value is str.

This makes Symbol handling simpler if one only cares about the text value. It also improves load performance for symbols significantly.

Symbols with undefined text cannot be emitted with this flag set and will raise exceptions.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.