Trying to use threading.local()

Chris Angelico rosuav at gmail.com
Thu Sep 13 12:43:31 EDT 2018


On Fri, Sep 14, 2018 at 1:07 AM, Peter Otten <__peter__ at web.de> wrote:
> However, the trouble begins with
>
> a/b  # magically determine context
>
> which has no way to smuggle in a third argument. The workaround while not
> pretty is at least straightforward:
>
> context.divide(a, b)

Exactly. You can pass a context to a function or method, but not to an
operator. And if you demand that functions/methods be used for
absolutely everything, just so you can pass a context around, you
require that absolutely everyone write Decimal-exclusive APIs, which
are then unable to handle other types of number.

ChrisA



More information about the Python-list mailing list