I’m C programmer and I used to avoid Arrow anti-pattern. Recently I’ve started coding in Python and it seems to me that Python language by itself encourage to use Arrow anti-pattern, because:
- The ‘with’ statement adds a level of indentation for the part of the code that uses specified resources.
- Indentations instead of braces to define suite (a block of code) makes code with a few nested levels shorter so more attractive to use.
- EAFP (Easier to ask for forgiveness than permission) leads to many ‘try’ and ‘except’ statements so more code is indented.
- The ‘else’ statement after ‘try’ and ‘except’ statements causes that more code is indented.
- The ‘else’ statement after ‘for’ statement causes that more code is indented.
Is Arrow still an anti-pattern in python?
Aucun commentaire:
Enregistrer un commentaire