[PYTHON] Which octal literals can be used depends on the programming language

(This article is a multipost with Go to the Horizon)

There are three main grammars for noting octal numbers. (The second and third are confusing, but they are zero o [^ octet])

Of these, the table summarizes which grammar each programming language uses.

language 0 0o 0O
C × ×
PHP × ×
Perl × ×
Java × ×
Scala (~2.9) × ×
Scala (2.10~) × × ×
Kotlin × × ×
C# × × ×
Rust × ×
Swift × ×
Go
Ruby
Python2
Python3 ×
JavaScript[^js]

Consideration

"I write the octal number as 0123 "may be old.

[^ octet]: octet (8-piece set) o [^ js]: However, if 0 is followed by 8 or 9, it is a decimal number. Reference: lexical grammar --JavaScript | MDN

Recommended Posts

Which octal literals can be used depends on the programming language
Python standard module that can be used on the command line
Hide the warning that zsh can be used by default on Mac
[Django] About users that can be used on template
Qiita can now be viewed on the console (shell)
The programming language you want to be able to use
Goroutine (parallel control) that can be used in the field
Goroutine that can be used in the field (errgroup.Group edition)
A timer (ticker) that can be used in the field (can be used anywhere)
Can the Kalman filter be used to predict stock price trends?
Let's touch on the Go language
About the matter that the re.compiled object can be used for the re.match pattern
Easy padding of data that can be used in natural language processing
The --security option cannot be used with the dnf command on CentOS Linux