On Fri, 07 Aug 2020 08:54:37 -
"Kazantcev Andrey"
wrote:
> Chris Angelico wrote:
> > Why do you want dump and load to take parameters from "somewhere
> > else"?
>
> Because developers of libraries don't think about configuring json.dump
> method in mos of cases.
Then you should report a
06.08.20 11:03, Kazantcev Andrey пише:
> JSON serialization used in many different libraries without the ability for
> configuration (Example
> https://github.com/aio-libs/aioredis/blob/8a207609b7f8a33e74c7c8130d97186e78cc0052/aioredis/commands/pubsub.py#L18).
> Propose to add something like the
What about __json__()?
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/arch
Chris Angelico wrote:
> Why do you want dump and load to take parameters from "somewhere
> else"?
Because developers of libraries don't think about configuring json.dump method
in mos of cases. I would like to have a mechanism that would allow tweaking the
behaviour for the entire program. I ju
On Fri, 7 Aug 2020 at 09:26, Kazantcev Andrey wrote:
>
> The problem in this code
>
> lib.py
> ```
> from json import dumps
>
> def some_func():
> # do something
> res = dumps(...)
> # do something
> ```
>
> I wish dump and load themselves could take parameters from somewhere else,
>
On Fri, Aug 7, 2020 at 6:24 PM Kazantcev Andrey wrote:
>
> The problem in this code
>
> lib.py
> ```
> from json import dumps
>
> def some_func():
> # do something
> res = dumps(...)
> # do something
> ```
>
> If I patch dumps like you propose lib doesn't see any change. Also, it's all
The problem in this code
lib.py
```
from json import dumps
def some_func():
# do something
res = dumps(...)
# do something
```
If I patch dumps like you propose lib doesn't see any change. Also, it's all
hacks. I wish dump and load themselves could take parameters from somewhere
el
On Fri, Aug 7, 2020 at 5:50 PM Kazantcev Andrey wrote:
>
> Chris Angelico wrote:
>
> > Not gonna be 100% reliable and I don't think it belongs in the stdlib,
> > but might be useful.
>
> That is the problem. Sometimes libs import only methods.
I don't see that often, do you have a specific exampl
Chris Angelico wrote:
> Not gonna be 100% reliable and I don't think it belongs in the stdlib,
> but might be useful.
That is the problem. Sometimes libs import only methods.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send a
On Fri, Aug 7, 2020 at 5:22 PM Kazantcev Andrey wrote:
>
> Maybe use context as a context manager.
>
> For example
>
> ```
> with json.Context(ensure_ascii=False):
> json.dumps(...)
> ```
>
> Implementation can be done via contextlib.
If all you want is a way to parameterize naive calls to js
Maybe use context as a context manager.
For example
```
with json.Context(ensure_ascii=False):
json.dumps(...)
```
Implementation can be done via contextlib.
___
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to p
I agree with Raymond. The "implicit context" pattern is really only
desirable in a small subset of situations, and I don't think
configuring JSON serialization is one of those.
(it may even be an active nuisance, because some libraries may be using
JSON as an implementation detail and a "JSON c
Based on experience with the decimal module, I think this would open a can of
worms. To match what decimal does, we would need a Context() object with
methods for dump, dumps, load, loads. There would need to be a thread-local or
contextvar instance accessed by getcontext and setcontext, and p
13 matches
Mail list logo