Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some Unicode characters look identical to ASCII ones #39

Closed
bastiaan85 opened this issue Sep 8, 2017 · 3 comments
Closed

Some Unicode characters look identical to ASCII ones #39

bastiaan85 opened this issue Sep 8, 2017 · 3 comments

Comments

@bastiaan85
Copy link

bastiaan85 commented Sep 8, 2017

In the 'Skipping lines' example (the first one), the following explanation is given as to why the two 'value' variables name aren't the same:

Some Unicode characters look identical to ASCII ones, but are considered distinct by the interpreter.

Imho this paints the wrong picture. ASCII is an encoding, Unicode is a character collection. ASCII isn't a synonym for the English alphabet. In Python 3, all strings are Unicode, it has lost the relation to any legacy encoding, and ASCII will fall more and more into disuse. The point the example tries to make is that certain Unicode characters are homoglyphs, and that those homoglyphs to an English alphabet character can provide a pitfall for an agnostic reader. I think it should read something like:

Some non-Western characters look identical to letters in the English alphabet, but are considered distinct by the interpreter. For example the Cyrillic 'е' (Ye) and the Latin 'e', which can be demonstrated by using the built-in ord() function, that returns a character's Unicode code point:

Then also the second code snippet can feature an actual different example than the first one instead of repeating the same value = something:

>>> ord('е') # cyrillic Ye
1077
>>> ord('e') # latin, as used in English
101
>>> 'е' == 'e'
False
@satwikkansal
Copy link
Owner

Agreed. Your explanation is more accurate and the example seems to be more relevant to the explanation. Will update this soon. 👍

@satwikkansal
Copy link
Owner

Hey @bastiaan85, Thank you so much for pointing this out. 76da1b8 has the changes as per your suggestions, feel free to reopen the issue if something is incorrect or missing :)

@bastiaan85
Copy link
Author

@satwikkansal : you're welcome, glad to be of help :)

muscliary pushed a commit to muscliary/wtfpython that referenced this issue Sep 12, 2023
* Add more accurate explanation
* Add more relevant example

Closes satwikkansal/wtfpython#39
tothetop430 added a commit to tothetop430/wtfpython that referenced this issue Dec 9, 2023
* Add more accurate explanation
* Add more relevant example

Closes satwikkansal/wtfpython#39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants