What's convention for naming a class or method as "class" in Python?
how to pronounce what
what kind of word is what
Let's say I have a class in Python like this:
class Student: def __init__(self, classs): self.classs = classs
Now, what's convention for naming a parameter (and class property)
classs? I saw
classs as well as
klass and I'm wondering: is there some convention for it? Didn't find it in PEP8.
PEP 8 advises to use a trailing underscore in that case:
See https://www.python.org/dev/peps/pep-0008/#descriptive-naming-styles for details:
single_trailing_underscore_ : used by convention to avoid conflicts with Python keyword, e.g.
What, The expression, "Give them what for" or simply, "what for", means to punish, reprimand, castigate, etc. If someone told u that u were going to be punished, your natural response would be, "what for" a.k.a. (the reason for punishment). Quickly send and receive WhatsApp messages right from your computer. Quickly send and receive WhatsApp messages right from your computer. WhatsApp Web.
The correct answer of
class_ from PEP 8 is awkward, in my opinion, and possibly problematic as commented elsewhere for that answer. The PyCharm IDE seems to prefer
cls for class methods, which annoys me for its coder-happy abbreviation, while the arguably more or less readable and understandable
klass is still a misspelling. So I'd like to throw out an alternative for these situations, including class wrappers and the like:
Class, which is not reserved due to the casing.
I know a lot of people are going to say that variables names should be lowercase, but the lines between object and type, class and function, variable and pre-defined are all blurred in Python. For instance, if I were to write:
NoneType = type(None)
would you argue that it should be renamed
NONE_TYPE because it's global?
NoneType is a class, though it is not defined using the
class keyword. Likewise
Class is a class, although it's also a variable. By capitalizing it, I'm just emphasizing one aspect over another. And I do this for all variables representing types.
What does "what for" mean and where did it come from?", is classified under pronouns because it replaces a thing or a noun. noun the true nature or identity of something, or the sum of its characteristics: a lecture on the whats and hows of crop rotation.
There isn't really a convention. I've seen - and probably used -
What Part of Speech is “WHAT”, 're going to sum something up in just a few words. Another way to say this would be "to make a long story short." informal a punishment or reprimand (esp in the phrase give (a person) what for) 7. what have you someone, something, or somewhere unknown or unspecified: cars, motorcycles, or what have you. 8.
What have you definition and meaning, I will do what I can to help you. TranslationsEdit. show ▽what? (interrogative pronoun) WhatsApp Messenger: More than 2 billion people in over 180 countries use WhatsApp to stay in touch with friends and family, anytime and anywhere. WhatsApp is free and offers simple, secure, reliable messaging and calling, available on phones all over the world.
in a nutshell, what meaning: 1. used to ask for information about people or things: 2. used in questions that show you are…. Learn more. In current usage that refers to persons or things, which chiefly to things and rarely to subhuman entities, who chiefly to persons and sometimes to animals. The notion that that should not be used to refer to persons is without foundation; such use is entirely standard.
what, More people are spending more time at home, so it's only right we give you more options for what to watch. This is the ORIGINAL "What What (In the Butt)" video. The South Park version aired over a year after we made this video. There's been a lot of confusion about this. We can assure you, we are not
- i've seen klass, clazz, cls.
- Thanks a lot, I overlooked that example.
- And Django doesn't allow trailing underscores for field names.
(fields.E001) Field names must not end with an underscore.. Damn :D