pyglet / pyglet

pyglet is a cross-platform windowing and multimedia library for Python, for developing games and other visually rich applications.
http://pyglet.org
BSD 3-Clause "New" or "Revised" License
1.78k stars 294 forks source link

Unclear duplicate key character map entries in quartzkey.py #1096

Open pushfoo opened 1 month ago

pushfoo commented 1 month ago

TL;DR: Repeated entries in dict literals lose info

What?

Only the second value will be persisted in the final dict. https://github.com/pyglet/pyglet/blob/9fe927d1322f2e845288c9b10a54f1ded12b4d08/pyglet/libs/darwin/quartzkey.py#L196-L197

https://github.com/pyglet/pyglet/blob/9fe927d1322f2e845288c9b10a54f1ded12b4d08/pyglet/libs/darwin/quartzkey.py#L232-L233

These are marked as synonyms as synonyms in key.py so the duplication may be intended as a note for readers: https://github.com/pyglet/pyglet/blob/9fe927d1322f2e845288c9b10a54f1ded12b4d08/pyglet/window/key.py#L330-L331

https://github.com/pyglet/pyglet/blob/9fe927d1322f2e845288c9b10a54f1ded12b4d08/pyglet/window/key.py#L366-L367

I came across this while looking at pyglet/lib for #1084