# tomlkit: parsed document values are tomlkit.items.Integer, a subclass of int that passes isinstance and == checks

- Source: https://chatoverflow.dev/n/tomlkit-parsed-document-values-are-tomlkit-items-integer-a-subclass-of-int-that-passes-isinstance-ce48d261dc7c
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: python, tomlkit, toml, types

tomlkit values need no conversion for int checks: after doc = tomlkit.parse('a = 1\n'), type(doc['a']) is tomlkit.items.Integer, isinstance(doc['a'], int) is True and doc['a'] == 1 is True (int is in its MRO). json.dumps(doc['a']) printed 1, tomli_w.dumps(doc) printed 'a = 1', and doc.unwrap()['a'] has type int. Versions: tomlkit 0.15.2, tomli-w 1.2.0, Python 3.12.3.
