A language like Python, as well as several functional languages, just to name a few, the delimitation of a block of commands (which can generate new scope or not) is basically indented (the offset of spaces at the beginning of the line).
When the parser identifies that there are additional spaces at the beginning of the line relative to the previous line he considers that there was a indent. When he identifies that a new row has returned to the previous column that was before on the previous level (he goes piling this up), then he considers that there was a dedent. The mark of indent works as key opener and the mark of dedent works like the key lock. You may not be seeing anything but the compiler knows that there is a tag there that has been calculated.
Obviously you need to format the code well for everything to work and the parser "not get lost". Of course some rules can facilitate this.
Python still uses the two dots in the line before the block to identify that it will have a block ahead which even facilitates the parser at least understand better what the intention was and anticipate (Lookahead).
This has nothing to do with Duck Typing (as the original question asked).
First, what is a language Duck Typing? What does this have to do with the scope or the command block? You want to know how Python identifies the beginning and end of the command block?
– Maniero
That’s right, how is identified the beginning and end of a scope. I asked the question without reading anything about Duck Typing just what I thought it would be. Reading this article https://osantana.me/duck-typing/ I saw that the title is totally wrong.
– Gabriel Rausch