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
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.
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 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@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
On 23 January 2013 20:14, Thomas Young thomasyoung@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@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Sorry, wasn't asking you to solve this issue. Just noting that python programmers are likely to be more used to seeing stuff 'incorrectly' coloured as keywords. I know I am used to accepting this when writing python. So including 'extra' keywords for colouring is not such a big deal IMHO..
Thomas
On 23/01/13 11:17, Lex Trotman wrote:
On 23 January 2013 20:14, Thomas Young thomasyoung@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@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel
On 23 January 2013 21:32, Thomas Young thomasyoung@free.fr wrote:
Sorry, wasn't asking you to solve this issue. Just noting that python programmers are likely to be more used to seeing stuff 'incorrectly' coloured as keywords. I know I am used to accepting this when writing python. So including 'extra' keywords for colouring is not such a big deal IMHO..
Thomas
Hi Thomas,
My reply was meant to convey sympathetic agreement on the issues of dynamic languages, which you obviously understand, rather than suggest that you were demanding we overcome them. Having been written too late in the day (my time) that didn't come across, sorry.
Cheers Lex
Hi,
differences in python versions, but because it actually seems to be ok to 'hide' built in stuff with your own definitions.
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 print False
True
Even if possible, nobody wants to do this :). Luckily, we already all agreed on this.
Back to Lex' initial question:
I write Python code all day long at work and love it. I'd say let's have the keywords of Python 2 and 3 in the config, as Lex suggested. In an ideal world, all people would switch to Python 3 shortly. Unfortunately, we don't live in an ideal world and I already know that I will have to continue writing Python 2 code for a long, long time.
I completely agree that a few extra keywords is less worse than missing ones. And if users are really disturbed by the extra keywords, they can adjust the list of keywords in their own config.
Regards, Enrico
Le 23/01/2013 06:17, Lex Trotman a écrit :
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.
I don't think these differences are big enough to legitimate the introduction of a new, confusing, filetype just for them. It's not like Python 2 and 3 are different languages, it's just that a *few* things got introduced or removed.
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.
Please, no.
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.
Agreed. I don't think it's a real problem to have e.g. print as a keyword for Python 3, and I think it's really not a problem to have the Python 3 keywords in Python 2.
What do other Python users think?
As a hobbyist Python writer and Geany developer, one single Python filetype, PLEASE!
Cheers, Colomban
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
[...]
+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.
Showing true modesty Matthew didn't post the script :)
It and the lists that result are here: https://github.com/codebrainz/geany/commit/ba35b893b7670f7580525e734fd028683...
If there are no supported objections in say, a week or so, then I suggest we use these lists and put the script in scripts for occasional updating the lists. Thanks Matthew.
Cheers Lex
Cheers, Matthew Brush
Devel mailing list Devel@lists.geany.org https://lists.geany.org/cgi-bin/mailman/listinfo/devel