Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
An additional option to allow the the non-encoding of python tuples #6
I added an option to the JSONEncoder to allow tuples to not be automatically encoded to arrays, for the use case when you need to preserve the difference between tuples and lists (in this case you can now encode tuples to a custom object using the default() method).
I added a basic test (tests/test_tuple.py) and checked that all the other tests ran.
Unfortunately I couldn't add it into the _speedups.c, so I addd a check to iterencode that if this option has been changed, it shouldn't use the speedups.
Actually, I don't think that being able to remove tuple from the array encoding is very useful... but encoding namedtuple as an object seems like the right thing to do. To support people who depended on the old behavior, there should also be a flag to turn this off.