elastic / elastic/opbeans-python

Example error that demonstrates why local vars are so useful

Đang mở
#4 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
7
Fork
14
Merge trung bình
14 giờ 16 phút
Pull request đã merge (30 ngày)
1

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.