osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trying to use threading.local()


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