Skip to content

Conversation

@Akuli
Copy link
Collaborator

@Akuli Akuli commented Feb 12, 2024

This is a less disruptive version of #11394.

In general, passing 0 or 1 is less readable and just not the right thing to do in new code. Users should just use the new and readable thing instead of the confusing legacy thing. Tkinter (and much of its documentation) was created before bool was added to Python.

That said, there's still plenty of example code around (e.g. stackoverflow answers, tkinter docstrings) that use 0 and 1. IMO we should apply Literal[0, 1] to tkinter booleans only when someone needs it in a specific place, not blindly to all boolean parameters.

This is also why I don't want yet another type alias, e.g. _TkBool = bool | Literal[0, 1]. In most cases, it's not the right thing to use, so I don't want a convenience thing for it.

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@Akuli Akuli merged commit b44d22e into python:main Feb 13, 2024
@Akuli Akuli deleted the tkinter-bool-01 branch February 13, 2024 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants