swaroopch / edn_format

EDN reader and writer implementation in Python, using PLY (lex, yacc)

Home Page:https://swaroopch.com/2012/12/24/edn-format-python/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

edn_format

Implements the EDN format in Python.

All features of EDN are implemented, including custom tagged elements.

Build Status PyPI version

Installation

pip install edn_format

Usage

>>> import edn_format
>>> edn_format.dumps({1, 2, 3})
'#{1 2 3}'
>>> edn_format.loads("[1 true nil]")
[1, True, None]
>>> edn_format.loads_all("1 2 3 4")
[1, 2, 3, 4]

In general, edn_format.loads(edn_format.dumps(obj)) == obj. If this is false, it may be a bug.

See tests.py for full details.

Contributors

Special thanks to the following contributors for making this library usable:

FAQ

Why immutable list & dict?

IIRC, it was related to https://github.com/edn-format/edn#rationale :

edn will yield distinct object identities when read, unless a reader implementation goes out of its way to make such a promise. Thus the resulting values should be considered immutable, and a reader implementation should yield values that ensure this, to the extent possible.

About

EDN reader and writer implementation in Python, using PLY (lex, yacc)

https://swaroopch.com/2012/12/24/edn-format-python/

License:Other


Languages

Language:Python 99.5%Language:Makefile 0.3%Language:Dockerfile 0.2%