elastic / elastic/opbeans-python
Example error that demonstrates why local vars are so useful
Ouverte
- Langage dominant
- Python
- Étoiles
- 7
- Forks
- 14
- Merge moyen
- 14 h 16 min
- PR mergées (30 j)
- 1
Description
Would be lovely to have an example error that shows why local variables are so useful. For example when debugging why some regex doesn't match. Let's say the developer assumed the regex would capture a group and then do something with it?
```python
phone_num = self.cleaned_data['phone']
country_code = phone_num.match(phone_num, '$(\+\d+)\-').groups[1]
```
throws an IndexError because there's no country code in the telephone number.
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Évaluation
Cette issue n'a pas encore été évaluée.