Request: Preserve Hexadecimal, Octal, and Binary Literals as-is in Tooltip Documentation #7328
EurFelux
started this conversation in
Enhancement
Replies: 1 comment
-
moving to discussion since this is feature request. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When providing documentation for methods, Pylance displays octal literals in decimal form. Take the
pathlib.Path.touch
method as an example. Following the convention ofchmod
, a three-digit octal number should be entered to represent file access permissions, and themode
parameter of thetouch
method also follows this rule. So I was very confused when I saw that the default value of themode
parameter was438
.I also verified the hexadecimal and binary cases and found that the behavior is consistent.
In fact, there is usually a good reason for specifying parameter defaults using non-decimal literals—for instance, because such forms are easier to understand. I think it would be helpful if Pylance could display default values that are given in forms like
0o
,0x
, or0b
exactly as they are, rather than converting them into decimal.Beta Was this translation helpful? Give feedback.
All reactions