+ 3

[SOLVED] Why are these of the same color in Spyder and of different color in whichever Python editor Corey Schafer uses?

code bit: class Employee: def __init__(self, first, last, pay): So, on Schafer's editor, different colors are used for "Employee" and "__init__", whereas on Spyder, the color used for both is the same. Why is that? Do colors not tell us anything about data types, operators, etc? Are we not to infer anything by looking at them, even if we don't know about the particular code bit they are used with? I've been meaning to ask about this for some time, now, and this seemed a good example. Thanks in advance. P. S. Do I say "in" an editor, or, "on" an editor?

19th Apr 2022, 1:44 PM
Korkunç el Gato
Korkunç el Gato - avatar
7 Antworten
+ 2
I choose a popular color scheme. So same work for anyone.. choice Generally, documentation leaves guidelines, better to follow them.. Stil it in user hands.. See, some cases.. Other than keyword which you can't use as your user defined types in most language like int, double,.. in java are strictly not allowed in using as variables so it can be easily differentiable. But in python, it allows to use built in types as custum user defined types like list, tuple, dict are can be also used as userdefined datatypes so you can strictly differentiate. Employer is a user defined class name, String is also a class name but it is a built in class, but you can also use it as user defined class name. Overwrite it. So you can differentiate.. But only keywords can differentiate from others.. In these cases, it may help/not help using different colors.. What approach you choose..? Criterion is follow guidelines.. It has no difference in program execution.
19th Apr 2022, 4:35 PM
Jayakrishna 🇮🇳
+ 2
Jayakrishna🇮🇳 Thank you for your response. I understand that colors themselves are IDE choice, but one IDE's coloring x and y the same w color, while the other IDE colors x in a and y in b. Why wouldn't the second one color x and y both, either in a or b?(same) Or why wouldn't the first IDE color x in c and y in d (differently) I mean these IDEs are acting differently not only in the color choice but what or when to apply it. (Employer is user defined, but Spyder gives it the same color with a built in function) So I guess then there's no criterion for that.
19th Apr 2022, 4:02 PM
Korkunç el Gato
Korkunç el Gato - avatar
+ 2
Jayakrishna🇮🇳 Thank you Jaya, I will keep conventions in mind when I start reading it. I am putting it off till I finish Python Core, here at SL. I've only seen the documentation in parts. To be honest, it looks a bit more complex than a layman can understand, at times. So I'll finish core first and probably have a look at some stuff about the way a high level language communicates to a machine... Lol we have to learn just to be able to learn :-)
19th Apr 2022, 4:51 PM
Korkunç el Gato
Korkunç el Gato - avatar
+ 2
May you looking it as how machine read colors when executing.. But these colors are nothing to do with "languages communicates to a machine ". It only visulazing scheme from ides. You can write any program in plane text editor which won't use any colors,and save with proper extension. then run this from command line.. You can get same result as with IDEs. You're welcome..
19th Apr 2022, 5:29 PM
Jayakrishna 🇮🇳
+ 2
Hi, there HungryTradie, thank you for letting me know more about how much of it is IDE or personal discretion. Could you elaborate on the last part about correct grammar? I code in X Python IDE, but I run the code on X Python IDE? Is coding just coding or is it catch all for all the actions done inside the script? Such as using colors? So... I use (blah = color Y) in or on Python IDE. Is that correct? Or does the latter sound funny? I mean, is this where it sounds funny?
19th Apr 2022, 8:11 PM
Korkunç el Gato
Korkunç el Gato - avatar
+ 1
It's IDE implementor choice but I think, they prefer to follow documentation guidelines.. and best color schemes.. Generally you can see, class name are should start with capital letter according to guidelines so those which starts with capital letters are colored in blue. And built-in keywords, builtin function names, literals like def, class, pass,... are colored in meroon color.. strings in green,.. so just to visualizes you better ways, differentiate between built in and user defined literals.. so that it can help to debug programs easily.... you can check in the options about the color about what ide meaning it.. and also I think you can change to also.. I think, I answered it relates to question at least some what. hope it helps..
19th Apr 2022, 2:53 PM
Jayakrishna 🇮🇳
+ 1
G'day Korkunç TheTerrible nice question! I reckon the grouping (or not grouping) of similarly coloured keywords/concepts is one of the points of difference between the IDEs. Some coders like that the IDE gives hints, some just want to be left to mash the keyboard. Other features might be selecting text like a word editor (click and drag along the words/lines), others select text like a spreadsheet, you can select the first characters of several lines without selecting the whole line. I reckon you code "in an IDE", but you do this or that "on an IDE". In works both ways, but on sounds funny when used the other way.
19th Apr 2022, 7:48 PM
HungryTradie
HungryTradie - avatar