On Sat, Jul 11, 2020 at 12:45 AM Steven D'Aprano <st...@pearwood.info> wrote:
>
> On Fri, Jul 10, 2020 at 02:50:17PM +1000, Chris Angelico wrote:
>
> > And immediately above that part, I said that I had made use of this,
> > and had used it in Python by listifying the dict first. Okay, so I
> > didn't actually dig up the code where I'd done this, but that's a use
> > case. I have *actually done this*. In both languages.
>
> I'm not calling you a liar, I'm just pointing out that saying "I have
> done this" is not a use-case. You must have had a reason for *why* you
> did it, beyond just "because I can!" (or in this case, "because I can't,
> so I used a list instead").
>
> It's the *why* that's important.
>

Okay, fair enough. I don't remember exactly what it was, but basically
I had a collection of things, identified by some sort of name, and
wanted to pick one of the currently available ones. If I *just* had
the things, I would have a list, and if I *just* had the names, I
would also have a list, and either way, I can pick one at random. But
having the dict means I have to go to the extra hassle to listify it.

Unfortunately I don't have the code to hand, and it's a bit hard to
search your hard drive for "a place where I wanted to call
random.choice on a dict but didn't". :)

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/CEB7UYI6AGL7ACX756JRH65NWY4GSEVH/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to