elastic / elastic/opbeans-python

Example error that demonstrates why local vars are so useful

Open
#4 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
7
Forks
14
Avg merge
14h 16m
Merged PRs (30d)
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.