From 76da1b8740a7b6eb2ad4f0210f785f26756f7764 Mon Sep 17 00:00:00 2001 From: Satwik Kansal Date: Mon, 11 Sep 2017 21:35:46 +0530 Subject: [PATCH] Skipping lines: Update explanation * Add more accurate explanation * Add more relevant example Closes https://github.com/satwikkansal/wtfpython/issues/39 --- README.md | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4a7f03c..e418b40 100755 --- a/README.md +++ b/README.md @@ -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...