On Mon, 11 Apr 2022 at 09:45, Ethan Furman <et...@stoneleaf.us> wrote:
>
> On 4/10/22 14:09, Chris Angelico wrote:
> > On Mon, 11 Apr 2022 at 06:48, Ethan Furman <et...@stoneleaf.us> wrote:
> >>
> >> On 4/10/22 10:17, Chris Angelico wrote:
> >>> On Mon, 11 Apr 2022 at 02:59, Christopher Barker wrote:
> >>
> >>>> But if I did that, then one lib registering my units with the global 
> >>>> repository might break some other lib's use of the global repository.
> >>>
> >>> Then... libraries should not register units unless it's at the behest
> >>> of the application? That's exactly what I've been saying.
> >>
> >> If the library cannot register its version of units, how can it use units 
> >> internally?
> >
> > Probably the same way that it's always been possible - with clunkier
> > syntax and explicit multiplications. I'm not sure.
>
> So mostly with none of the benefits of the new systax.

Yes. If there are libraries that need to be completely independent of
the application, they won't be able to take advantage of the new
syntax.

> > Do you actually
> > have a use-case where a library needs to do unit-aware arithmetic
> > independently of the application,
>
> At this point I am not a unit user, but it seems that several who are would 
> like finer grained control, and you are
> arguing that global is fine; they offer json as an example where the 
> application imposing global settings on their
> activities would really mess them up, and you don't seem to be 
> hearing/acknowledging that.
>

I'm hearing it, I'm just not seeing the parallel. Remember: Nobody is
ever saying that existing unit libraries have to go away. This is a
proposal for a syntax that will allow for a more convenient way of
writing them. So far, I've yet to see anything more than a 100%
hypothetical "what if multiple libraries do things" concern, and at no
point has ANYONE ever shown why the module level is the correct scope.
Comparing with Decimal contexts shows that sometimes we need broader,
and sometimes narrower, scope than the module, and that the module is
simply not sufficient. Why bind unit definitions to the module if it's
not even going to be useful?

Having never personally used multiple JSON libraries at the same time,
I have no idea what sort of global settings would get in their way,
but I have most certainly used Decimal contexts, and I generally
assume and expect that calls to library functions will be affected by
changes to the context. If I do that change with
decimal.getcontext().prec = N once at the top of the program, I fully
expect that it will affect every module. Is this considered to be a
bad thing? If not, why is it bad for units?

ChrisA
_______________________________________________
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/archives/list/python-ideas@python.org/message/ZU2TN4HLMXFQMPMO2X7LZLZVNYZHAGJR/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to