[Geany-Devel] Python filetype 2 or 3 or both?

Matthew Brush mbrush at codebrainz.ca
Fri Jan 25 23:18:46 UTC 2013


On 13-01-22 09:17 PM, Lex Trotman wrote:
> Hi All,
>
> We have only one Python filetype, but Python has two versions.
>
> There are some differences between them in terms of keywords and builtins.
>
> For example exec, nonlocal, True, False and None are not keywords for
> Python 2 but are for 3.
>
> And print is a keyword for 2 but not for 3.
>
> There are similar changes to the builtins.
>
> At the moment True, False and None are in the keyword list but exec
> and nonlocal are not.  There is a PR to remove True, False and None.
>
> Since Python 3 is gaining ground I suggest that it would be better to
> have an aggregate of both Pythons for both keywords and builtins.
> Whilst that is wrong for both, I think missing keywords is worse than
> extras.
>

+1

> What do other Python users think?
>

My 2¢ as a themer and Python user is that True, False, None, and 
nonlocal should be in 'primary' keywords list and 'print' and 'exec' 
should go should into 'identifiers' keywords list (with other built-in 
functions). Even if it's Py3 way, it works fine for Py2 as well.

I made a little script to automate this merging of the keyword lists, if 
we want to use it I could update the keywords lists in 
'filetypes.python', and possibly put the script in the 'scripts' 
directory in the source tree for future use.

Cheers,
Matthew Brush



More information about the Devel mailing list