Why no list as dict key?

Larry Martell larry.martell at gmail.com
Wed Apr 20 14:25:58 EDT 2022


On Wed, Apr 20, 2022 at 2:23 PM Abdur-Rahmaan Janhangeer
<arj.python at gmail.com> wrote:
>
> Greetings list,
>
> Using Python3.9, i cannot assign a list [1, 2] as key
> to a dictionary. Why is that so? Thanks in advanced!

Dict keys cannot be mutable. Use a tuple instead.


More information about the Python-list mailing list