elastic / elastic/opbeans-python

Example error that demonstrates why local vars are so useful

オープン
#4 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
7
フォーク
14
平均マージ
14時間 16分
マージ済み PR(30日)
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 を短くまとめたダイジェスト。