elastic / elastic/opbeans-python

Example error that demonstrates why local vars are so useful

未关闭
#4 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
7
派生
14
平均合并
14 小时 16 分钟
30 天内合并 PR
1

描述

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.

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。