Unicode 7

Ned Batchelder ned at nedbatchelder.com
Fri May 2 13:46:08 EDT 2014


On 5/2/14 12:50 PM, Rustom Mody wrote:
> Just noticed a small thing in which python does a bit better than haskell:
> $ ghci
> let (fine, fine) = (1,2)
> Prelude> (fine, fine)
> (1,2)
> Prelude>
>
> In case its not apparent, the fi in the first fine is a ligature.
>
> Python just barfs:
>
>>>> >>>fine = 1
>    File "<stdin>", line 1
>      fine = 1
>      ^
> SyntaxError: invalid syntax
>>>> >>>

Surely by now we could at least be explicit about which version of 
Python we are talking about?

   $ python2.7
   Python 2.7.2 (default, Oct 11 2012, 20:14:37)
   [GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on 
darwin
   Type "help", "copyright", "credits" or "license" for more information.
   >>> fine = 1
     File "<stdin>", line 1
       fine = 1
       ^
   SyntaxError: invalid syntax
   >>> ^D
   $ python3.4
   Python 3.4.0b1 (default, Dec 16 2013, 21:05:22)
   [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
   Type "help", "copyright", "credits" or "license" for more information.
   >>> fine = 1
   >>> fine
   1

In Python 2 identifiers must be ASCII.  Python 3 allows many Unicode 
characters in identifiers (see PEP 3131 for details: 
http://legacy.python.org/dev/peps/pep-3131/)

-- 
Ned Batchelder, http://nedbatchelder.com




More information about the Python-list mailing list