elastic / elastic/opbeans-python

Example error that demonstrates why local vars are so useful

Aperta
#4 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
7
Fork
14
Merge medio
14h 16m
PR unite (30g)
1

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.