[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-04 Thread Dom Grigonis
> On 2 Jul 2023, at 10:12, Paul Moore wrote: > > On Sun, 2 Jul 2023 at 06:11, Christopher Barker > wrote: > > The OP of this thread is not alone -- folks want an authoritative source > ... > Unfortunately, too much of this discussion is framed as “someone should”,

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-02 Thread MRAB
On 2023-07-02 17:14, Stephen J. Turnbull wrote: MRAB writes: > I would hope that if the maintainer knew that the package was on > the curated list, they would let the list know if they were going > to stop maintaining it. That would be part of being on the list - > informing the list's

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-02 Thread Stephen J. Turnbull
MRAB writes: > I would hope that if the maintainer knew that the package was on > the curated list, they would let the list know if they were going > to stop maintaining it. That would be part of being on the list - > informing the list's maintainers of any significant change of > status.

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-02 Thread MRAB
On 2023-07-02 06:59, Chris Angelico wrote: On Sun, 2 Jul 2023 at 15:48, Christopher Barker wrote: Only re (the one in the stdlib)? What if you want PCREs - there's no package called "pcre" but there's "pcre2", "python-pcre", and probably others. And are those three (and others?) actually

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-02 Thread Paul Moore
On Sun, 2 Jul 2023 at 06:11, Christopher Barker wrote: > > The OP of this thread is not alone -- folks want an authoritative source > Authority is built over time. Unless someone starts doing this, there will never be any authoritative source. In case it’s not obvious, none of the projects or

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-02 Thread Dom Grigonis
Some automation could be done for adding new packages to already existing PRs, where correct addition would integrate nicely, align stats, such as last update, stack trends, benchmarks > On 2 Jul 2023, at 09:36, Christopher Barker wrote: > > On Sat, Jul 1, 2023 at 11:01 PM Chris Angelico

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-02 Thread Chris Angelico
On Sun, 2 Jul 2023 at 16:36, Christopher Barker wrote: > > However, the amount of time the two of us have spent on this thread could > have been used to review the status of quite a few packages :-) > >> >> Indeed. But I expect it'd be easier to get one person to write one >> blog post about

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-02 Thread Christopher Barker
On Sat, Jul 1, 2023 at 11:01 PM Chris Angelico wrote: > Would you know that even if they were on some official curated list? > Projects get abandoned at any time, and unless the curators are > constantly checking every package for currency, it's no different - > except that people will expect it

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-02 Thread Chris Angelico
On Sun, 2 Jul 2023 at 15:48, Christopher Barker wrote: >> Only re (the one in the stdlib)? What if you want PCREs - >> there's no package called "pcre" but there's "pcre2", "python-pcre", >> and probably others. > > > And are those three (and others?) actually useful maintained packages? Or >

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Christopher Barker
On Sat, Jul 1, 2023 at 10:24 PM Chris Angelico wrote: > On Sun, 2 Jul 2023 at 15:11, Christopher Barker > wrote: > > The OP of this thread is not alone -- folks want an authoritative source > -- they may not get that > > An authoritative source is absolutely perfect for someone who wants > less

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Christopher Barker
On Sat, Jul 1, 2023 at 8:42 AM MRAB wrote: > (a PyPI build farm, anyone?) > Funny that you should mention that - I mentioned conda-forge as a lightly curated collection. But it didn't start out with that aim in mind. It started as a way for folks to collaborate on building conda packages.

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Chris Angelico
On Sun, 2 Jul 2023 at 15:11, Christopher Barker wrote: > The OP of this thread is not alone -- folks want an authoritative source -- > they may not get that An authoritative source is absolutely perfect for someone who wants less choices. "Just give me the one and only option and promise me

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Christopher Barker
On Sat, Jul 1, 2023 at 3:24 PM Dom Grigonis wrote: > The less centralized it is, the less bad things can happen. > > Sure, but in a way the less good things can happen as well :-(. The OP of this thread is not alone -- folks want an authoritative source -- they may not get that, but a bunch of

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Dom Grigonis
> >> What’s the worst that can happen? >> > > The less centralized it is, the less bad things can happen. True, but the risk can be minimised if only appropriate cases were streamlined. Only well researched, well defined, unambiguous problems, that depend on mature components of core python

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Chris Angelico
On Sun, 2 Jul 2023 at 07:00, Dom Grigonis wrote: > > If it’s curated by more experienced members of this mailing list I would feel > more confident in depending on it and more keen to contribute and review PRs. > Maybe, with luck, if some good robust solution arises, it could be > streamlined

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Dom Grigonis
If it’s curated by more experienced members of this mailing list I would feel more confident in depending on it and more keen to contribute and review PRs. Maybe, with luck, if some good robust solution arises, it could be streamlined to python core library, if deemed appropriate. It could

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Paul Moore
On Sat, 1 Jul 2023 at 16:41, MRAB wrote: > How about adding ticks to some PyPI packages? :-) > > (There's still the problem of who gets to decide which ones get a tick...) Precisely. This is just curation but having PyPI host the curators' decisions. And we've already established that the PyPI

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread MRAB
On 2023-07-01 11:22, Paul Moore wrote: On Sat, 1 Jul 2023 at 07:09, Christopher Barker > wrote: So I think light curation would help a lot. [*] I'd be completely in favour of someone setting up a curated package index. You could probably use the Warehouse

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Stephen J. Turnbull
Chris Angelico writes: > On Sat, 1 Jul 2023 at 18:43, Stephen J. Turnbull > wrote: > > But if somebody's going to put in effort to review PyPI, I'd > > really rather see them go after "typo squatters". > > They're definitely working on that. OK, I'll take that as "Steve, report the ones

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Chris Angelico
On Sat, 1 Jul 2023 at 22:32, Dom Grigonis wrote: > > Another idea, maybe this group could host a simple git repo. > This has the same problem of who is curating it. If it's uncurated, that's PyPI as it already is. If it's controlled by the PyPA or PSF, then it gives too much authority. ChrisA

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Dom Grigonis
Another idea, maybe this group could host a simple git repo. If idea of extension is reasonable, but it’s not for standard library, open source is not reliable or it's time for consensus and centralisation. Then people can make some PRs, see where it goes. In this case, OP could scan PyPI,

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Paul Moore
On Sat, 1 Jul 2023 at 07:09, Christopher Barker wrote: > So I think light curation would help a lot. [*] > I'd be completely in favour of someone setting up a curated package index. You could probably use the Warehouse codebase if you didn't want to write your own. There would probably be a

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Chris Angelico
On Sat, 1 Jul 2023 at 18:43, Stephen J. Turnbull wrote: > > Chris Angelico writes: > > On Sat, 1 Jul 2023 at 01:15, Christopher Barker > > wrote: > > > > Totally different topic, but I do think that a "curated" package > > > repo would be helpful -- there is a lot of cruft on PyPi :-( > >

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Stephen J. Turnbull
Chris Angelico writes: > On Sat, 1 Jul 2023 at 01:15, Christopher Barker > wrote: > > Totally different topic, but I do think that a "curated" package > > repo would be helpful -- there is a lot of cruft on PyPi :-( Sounds like a "standard library". I understand the difference, but Like

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Chris Angelico
On Sat, 1 Jul 2023 at 16:09, Christopher Barker wrote: >If the PSF recommends a package > > Who said anything about the PSF? ;-) -- but yes, that would be another way > to go -- a tightly curated collection -- lower barrier to entry than the > standard library, but still pretty high. Who

[Python-ideas] Re: dict method to retrieve a key from a value

2023-07-01 Thread Christopher Barker
On Fri, Jun 30, 2023 at 8:34 AM Chris Angelico wrote: > > Totally different topic, but I do think that a "curated" package repo > would be helpful -- there is a lot of cruft on PyPi :-( > > > > That idea gets thrown around every once in a while, but there are a > few problems with it. Well

[Python-ideas] Re: dict method to retrieve a key from a value

2023-06-30 Thread Chris Angelico
On Sat, 1 Jul 2023 at 01:15, Christopher Barker wrote: > Totally different topic, but I do think that a "curated" package repo would > be helpful -- there is a lot of cruft on PyPi :-( > That idea gets thrown around every once in a while, but there are a few problems with it. When you "bless"

[Python-ideas] Re: dict method to retrieve a key from a value

2023-06-30 Thread Christopher Barker
Google: "python more collections pypi" gets quite a few hits -- I haven't checked out any of them though. Depending on a third party package does take some thought -- but for something like this you could simply "vendor" a particular class (i.e. include the code with yours). Totally different

[Python-ideas] Re: dict method to retrieve a key from a value

2023-06-30 Thread Dom Grigonis
In my experience, the implementation of bijective dict is largely application specific. 1. Unique-valued dict is fairly straight forward and there is little ambiguity on implementation using 2 dicts. 2. However, if values are not to be unique, then it largely depends on application. (best (as

[Python-ideas] Re: dict method to retrieve a key from a value

2023-06-30 Thread Barry Scott
> On 30 Jun 2023, at 02:50, Andre Delfino wrote: > > A dict method to retrieve the key of a value from a bijective dict would have > come in handy to me in several occasions: > names = {'one': 1} names.inverse()[1] > 'one' names = {'one': 1, 'uno': 1} names.inverse()[1]

[Python-ideas] Re: dict method to retrieve a key from a value

2023-06-30 Thread Stephen J. Turnbull
Christopher Barker writes: > > If O(log N) is good enough and bijectivity is guaranteed by some > > other mechanism, a bisection search on d.items() with > > key=lambda x: x[1] does the trick. > You'd also have to keep it sorted by value. I assumed you can do that with OrderedDict. But

[Python-ideas] Re: dict method to retrieve a key from a value

2023-06-30 Thread Christopher Barker
I've had use cases for this, and written a class to do it (using Stephen's two dict approach. I'd be really surprised if there wasn't one on PyPi --the trick is to know what to call it to search for it. Now that I think about it -- my use case was many-to-many, not one to one -- so not quite the