elastic / elastic/opbeans-python
Example error that demonstrates why local vars are so useful
Offen
- Vorherrschende Sprache
- Python
- Sterne
- 7
- Forks
- 14
- Ø Merge
- 14 Std. 16 Min.
- Gemergte PRs (30 T.)
- 1
Beschreibung
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.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.