Raymond Hettinger <[email protected]> added the comment:
If the json.encoder code does get updated, it doesn't need two levels of
matching. It can be flattened by eliminating the *chunks* variable.
match value:
case str():
yield _encoder(value)
case None:
yield 'null'
case True:
yield 'true'
case False:
yield 'false'
case int():
yield _intstr(value)
case float():
yield _floatstr(value)
case list() | tuple():
yield from _iterencode_list(value, _current_indent_level)
case dict():
yield from _iterencode_dict(value, _current_indent_level)
case _:
yield from _iterencode(value, _current_indent_level)
----------
nosy: +rhettinger
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue44276>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com