mirror of
https://github.com/satwikkansal/wtfpython
synced 2024-11-25 04:24:23 +01:00
Skipping lines: Update explanation
* Add more accurate explanation * Add more relevant example Closes https://github.com/satwikkansal/wtfpython/issues/39
This commit is contained in:
parent
2ade33dc6b
commit
76da1b8740
15
README.md
vendored
15
README.md
vendored
@ -172,15 +172,24 @@ Wut?
|
||||
|
||||
#### 💡 Explanation
|
||||
|
||||
Some Unicode characters look identical to ASCII ones, but are considered distinct by the interpreter.
|
||||
Some non-Western characters look identical to letters in the English alphabet, but are considered distinct by the interpreter.
|
||||
|
||||
```py
|
||||
>>> value = 42 #ascii e
|
||||
>>> valuе = 23 #cyrillic e, Python 2.x interpreter would raise a `SyntaxError` here
|
||||
>>> ord('е') # cyrillic 'e' (Ye)
|
||||
1077
|
||||
>>> ord('e') # latin 'e', as used in English and typed using standard keyboard
|
||||
101
|
||||
>>> 'е' == 'e'
|
||||
False
|
||||
|
||||
>>> value = 42 # latin e
|
||||
>>> valuе = 23 # cyrillic 'e', Python 2.x interpreter would raise a `SyntaxError` here
|
||||
>>> value
|
||||
42
|
||||
```
|
||||
|
||||
The built-in `ord()` function returns a character's Unicode [code point](https://en.wikipedia.org/wiki/Code_point), and different code positions of cyrillic 'e' and latin 'e' justify the behavior of the above example.
|
||||
|
||||
---
|
||||
|
||||
### Well, something is fishy...
|
||||
|
Loading…
Reference in New Issue
Block a user