Message266142
| Author |
cwr |
| Recipients |
cwr, ezio.melotti, vstinner |
| Date |
2016年05月23日.12:53:59 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1464008039.38.0.432855281585.issue27092@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Hi,
is there any reason why ord() raises a TypeError instead of ValueError on string/bytes input with wrong length?
The chr() function will raise a ValueError on negative integers such as chr(-1).
Required behaviour:
try:
n = ord(input_string)
except ValueError as e:
# it's a string/bytes-string, process potential escape sequence and
# get an ordinal number of decoded escape sequence, otherwise raise
...
with kind regards,
Chris |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2016年05月23日 12:53:59 | cwr | set | recipients:
+ cwr, vstinner, ezio.melotti |
| 2016年05月23日 12:53:59 | cwr | set | messageid: <1464008039.38.0.432855281585.issue27092@psf.upfronthosting.co.za> |
| 2016年05月23日 12:53:59 | cwr | link | issue27092 messages |
| 2016年05月23日 12:53:59 | cwr | create |
|