[beginner] What's wrong?

Chris Angelico rosuav at gmail.com
Wed Apr 6 20:42:34 EDT 2016


On Thu, Apr 7, 2016 at 5:56 AM, Thomas 'PointedEars' Lahn
<PointedEars at web.de> wrote:
>> Example 1 -- Ligatures:
>>
>> Python3 gets it right
>>>>> flag = 1
>>>>> flag
>> 1
>
> Fascinating; confirmed with
>
> | $ python3
> | Python 3.4.4 (default, Jan  5 2016, 15:35:18)
> | [GCC 5.3.1 20160101] on linux
> | […]
>
> I do not think this is correct, though.  Different Unicode code sequences,
> after normalization, should result in different symbols.
>
>> Whereas haskell gets it wrong:
>> Prelude> let flag = 1
>> Prelude> flag
>>
>> <interactive>:3:1: Not in scope: ‘flag’
>> Prelude> flag
>> 1
>> Prelude>
>
> I think Haskell gets it right here, while Py3k does not.  The “fl” is not to
> be decomposed to “fl”.

Unicode disagrees with you. It is decomposed exactly that way.

>>> unicodedata.normalize("NFKD","fl")
'fl'

ChrisA



More information about the Python-list mailing list