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

Lex Trotman elextr at gmail.com
Wed Jan 23 10:17:28 UTC 2013


On 23 January 2013 20:14, Thomas Young <thomasyoung at free.fr> wrote:
> Hi Lex,
>
> For myself, yes, I'd definitely say that missing keywords is worse than
> extras.
> And just including all of these as keywords seems fine.
>
> As an aside note that I quite often find myself getting stuff like local
> variables and parameters coloured as keywords in wing, not because of
> differences in python versions, but because it actually seems to be ok to
> 'hide' built in stuff with your own definitions.

Not much we can do for that, we only know identifier names, not what
they have been/not been defined as.  And I might add neither does
Python until runtime.

>
> See, for example, the following:
>
> python 2.7.3 (default, Sep 26 2012, 21:51:14)
> [GCC 4.7.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> False = True

Which is probably why they are keywords in Python 3, so this is illegal :)

Cheers
Lex

>>>> print False
> True
>>>>
>
> (I wouldn't do this in real code, but in many situations it is quite
> convenient to not worry about trying to avoid name clashes with built in
> tags!)
>
> Best regards,
>
> Thomas
>
>
>
> On 23/01/13 06:17, 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.
>>
>> What do other Python users think?
>>
>> Cheers
>> Lex
>> _______________________________________________
>> Devel mailing list
>> Devel at lists.geany.org
>> https://lists.geany.org/cgi-bin/mailman/listinfo/devel
>>
> _______________________________________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/devel


More information about the Devel mailing list