https://docs.python.org/3/reference/compound_stmts.html#grammar-token-suite
suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT
I can understand the 'DEDENT' word as "Dedent Region" in IDLE(Ctrl+[), But I can't understand the 'detent' appear in python reference document, is "DEDENT" one special character?
It's not a character per se - it is a token that represents the fact that the current line is indented by less spaces than the one before.
So for example the code:
foo
if bar:
  bay
baz
would be tokenized as ID(foo), NEWLINE, IF, ID(bar), COLON, NEWLINE, INDENT, ID(bay), NEWLINE, DEDENT, ID(baz).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With