On 2022-04-25 15:13:19 +0200, Lars Liedtke wrote:
> May I stupidly ask, why one would want to use an iterable (even immutable)
> as dict key?

A string is also an immutable iterable, so this is probably even the
most common case.

As for more complex data structures:

* Tuples or immutable dicts are a good fit if want to group records by
  subset of their attributes (think "group by" in SQL)

* Objects in general are often though of as units, even if they have
  composite values and you might want to look up something by that
  value.

        hp

-- 
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | h...@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment: signature.asc
Description: PGP signature

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to