Public Class Attributes, Class Methods, Static Methods:
CapCamelCase
Example: TotalInstances Storage
Private Class Attributes, Class Methods, Static Methods:
leading underscore CapCamelCase, methods verbs, sequences plural nouns
Example: _TotalInstances _Storage __Entries
Very Private Class Attributes, Class Methods, Static Methods (mangled with class name):
leading double underscore CapCamelCase, methods verbs, sequences plural nouns
Example: TotalInstances Storage __Entries
Public Functions (not methods): lowerCamelCase
Examples: doGood()
Public Instance Methods and Attributes:
lowerCamelCase, Methods should be verbs, sequences should be plural nouns
Examples: getName setStyle, display, first, last, itemCount, entities, books, data
Private Instance and Attributes (not exported with from import *):
leading underscore with lowerCamelCase, Methods should be verbs, sequences plural nouns
Examples: _getScore _setInternal _lastName _count _entries
Very Private Instance Methods or Attributes (mangled with class name):
double leading underscore with lowerCamelCase, methods verbs, sequences plural nouns
Examples: getMyName displayMoney creature secretData __entries
Global Variables (not Constants):
Capitalized_With_Underscores
Examples: Bad_Practice REO_Lat_Lon_NE
Pylon Globals used first letter lower case. should go back and change to uppercase to be consistent
Module Specific Globals (not exported by from import *):
underscore CapCamelCase
Examples: _DirtyBit
Constants:
UPPER_CASE_WITH_UNDERSCORES
not meant to be changed should be numbers or strings
Examples: MY_CONSTANT
Local Variables and function parameters:
lowerCamelCase
Any name that conflicts with python reserved word
add trailing underscore:
Examples: id, file, Bork_
Python Library methods and attributes are small case with underscores
Python builtins are small case no underscores
Abbreviations: When using CapCamelCase or mixedCase the abbreviations should be treated as words
httpSend sendHttp
unless the the abbreviation is the last word then one could use all caps. sendHTTP whichever feels better.
suffix mapping
Adjective describing module. What does the module enable one to do.
Verb is the do act
Object is actor doer
Place to keep track of Objects container doery actorery doerage actorage
of an Doer is a doery or doage or dodom or dohood
-er -or -ster Agent one who does something
-age state of acting actor to act actorage
-ery a place for an actor to act Acterery
-dom state of doing acting
-hood
-ship
-ion tion sion doion action
-ize to make
doize
Someone who makes one do
izer
doizer
actizer
English suffixes (reference)
One of the challenges in programming is coming up with short terms that do not conflict or do not have too much
baggage often new terms may be created using standard conventions for suffixing English words.
The key mnemonic is that the new term evoke the meaning associated with its use. After a couple of uses the new term
will become memorable.
Suffix Meaning Examples Used
able, ible capable of, worthy agreeable, comfortable, credible
age act of or state of salvage, bondage
acy, isy quality hypocrisy, piracy
al, eal, ial on account of related to, action of judicial, official arrival, refusal
ance, ence act or fact of doing state of violence, dependence allowance, insurance
ant quality of one who defiant, expectant, reliant occupant, accountant
er, or agent, one who author, baker, winner
eur, er, or one who dictator, chauffeur, worker
ed past jumped, baked
ery a place to practice of condition of nunnery, cannery surgery bravery, drudgery
dom state, condition of wisdom, kingdom, martyrdom
ent having the quality of different, dependent, innocent
en made of, to make woolen, wooden, darken
er degree of comparison harder, newer, older 5440
est highest of comparison cleanest, hardest, softest 1339
ful full of graceful, restful, faithful 212
hood state of being boyhood, knighthood, womanhood 61
ible, ile, il capable of being digestible, responsible, docile, civil 783
ier, ior one who carrier, warrior 1114
ify to make magnify, beautify, falsify 125
ic like, made of metallic, toxic, poetic 3774
ing action of running, wishing 5440
ion act or state of confusion, correction, protection 3362
ism fact of being communism, socialism 1147
ish like childish, sheepish, foolish 566
ist a person who does artist, geologist 1375
ity, ty state of majesty, chastity, humanity 4795
itis inflammation of appendicitis, tonsillitis 124
ive having nature of attractive, active 961
ize to make pasteurize, motorize 637
less without motionless, careless, childless 282
let small starlet, eaglet 185
ly like, in a manner happening heavenly, remarkably, suddenly every absolutely, monthly 5440
ment state or quality act of doing accomplishment, excitement placement, movement 680
meter device for measuring thermometer, barometer 166
ness state of blindness, kindness 3322
ology study of geology, zoology, archaeology 374
ous, ious full of joyous, marvelous, furious 1615
ship quality of or state of rank of friendship, leadership governorship, lordship 214
scope instrument for seeing telescope, microscope 79
some like tiresome, lonesome 83
tion, sion action, state of being condition, attention, fusion 3111
ty quality or state of liberty, majesty 2630
ward toward southward, forward 111
y like, full of action of diminutive, endearing noisy, sooty, jealousy inquiry kitty, Billy 5440
KeriPy Python Style Guilde
In general its PEP-8 with some variations, notably using camel case instead of underscore case.
The Python Peps on style have many options or allowed variants. The purpose of this document is to select a single preferred style in every case.
Indentation 4 spaces (detab ie no tabs convert tabs to spaces)
Naming conventions
alllowercase ALLUPPERCASE mixedCase lowerCamelCase CapitalCamelCase lower_case_with_underscores UPPER_CASE_WITH_UNDERSCORES Capitalized_With_Underscores lowercasenounderscores
Module Names all lower case. End name in ing so when doing namespace know that first ref is module not class behaving, clustering, functioning
Class Names:
CapCamelCase Examples: Person BigDogs
Exception Classes: CapCamelCase Example: StandardMuxError
Public Class Attributes, Class Methods, Static Methods: CapCamelCase Example: TotalInstances Storage
Private Class Attributes, Class Methods, Static Methods: leading underscore CapCamelCase, methods verbs, sequences plural nouns Example: _TotalInstances _Storage __Entries
Very Private Class Attributes, Class Methods, Static Methods (mangled with class name): leading double underscore CapCamelCase, methods verbs, sequences plural nouns Example: TotalInstances Storage __Entries
Public Functions (not methods): lowerCamelCase Examples: doGood()
Public Instance Methods and Attributes:
lowerCamelCase, Methods should be verbs, sequences should be plural nouns Examples: getName setStyle, display, first, last, itemCount, entities, books, data
Private Instance and Attributes (not exported with from import *):
leading underscore with lowerCamelCase, Methods should be verbs, sequences plural nouns Examples: _getScore _setInternal _lastName _count _entries
Very Private Instance Methods or Attributes (mangled with class name): double leading underscore with lowerCamelCase, methods verbs, sequences plural nouns Examples: getMyName displayMoney creature secretData __entries
Global Variables (not Constants): Capitalized_With_Underscores Examples: Bad_Practice REO_Lat_Lon_NE Pylon Globals used first letter lower case. should go back and change to uppercase to be consistent
Module Specific Globals (not exported by from import *): underscore CapCamelCase Examples: _DirtyBit
Constants:
UPPER_CASE_WITH_UNDERSCORES not meant to be changed should be numbers or strings Examples: MY_CONSTANT
Local Variables and function parameters: lowerCamelCase
Any name that conflicts with python reserved word add trailing underscore: Examples: id, file, Bork_
Python Library methods and attributes are small case with underscores
Python builtins are small case no underscores
Abbreviations: When using CapCamelCase or mixedCase the abbreviations should be treated as words httpSend sendHttp unless the the abbreviation is the last word then one could use all caps. sendHTTP whichever feels better.
suffix mapping
Adjective describing module. What does the module enable one to do. Verb is the do act Object is actor doer Place to keep track of Objects container doery actorery doerage actorage of an Doer is a doery or doage or dodom or dohood
-er -or -ster Agent one who does something
-age state of acting actor to act actorage -ery a place for an actor to act Acterery -dom state of doing acting -hood -ship -ion tion sion doion action
-ize to make doize
Someone who makes one do izer
doizer actizer
English suffixes (reference)
One of the challenges in programming is coming up with short terms that do not conflict or do not have too much baggage often new terms may be created using standard conventions for suffixing English words. The key mnemonic is that the new term evoke the meaning associated with its use. After a couple of uses the new term will become memorable.
http://www.paulnoll.com/Books/Clear-English/English-suffixes-1.html http://www.prefixsuffix.com/rootchart.php
Suffix Meaning Examples Used able, ible capable of, worthy agreeable, comfortable, credible age act of or state of salvage, bondage acy, isy quality hypocrisy, piracy al, eal, ial on account of related to, action of judicial, official arrival, refusal
ance, ence act or fact of doing state of violence, dependence allowance, insurance ant quality of one who defiant, expectant, reliant occupant, accountant
er, or agent, one who author, baker, winner
eur, er, or one who dictator, chauffeur, worker ed past jumped, baked
ery a place to practice of condition of nunnery, cannery surgery bravery, drudgery dom state, condition of wisdom, kingdom, martyrdom ent having the quality of different, dependent, innocent
en made of, to make woolen, wooden, darken
er degree of comparison harder, newer, older 5440 est highest of comparison cleanest, hardest, softest 1339 ful full of graceful, restful, faithful 212 hood state of being boyhood, knighthood, womanhood 61 ible, ile, il capable of being digestible, responsible, docile, civil 783 ier, ior one who carrier, warrior 1114 ify to make magnify, beautify, falsify 125 ic like, made of metallic, toxic, poetic 3774 ing action of running, wishing 5440 ion act or state of confusion, correction, protection 3362 ism fact of being communism, socialism 1147 ish like childish, sheepish, foolish 566 ist a person who does artist, geologist 1375 ity, ty state of majesty, chastity, humanity 4795 itis inflammation of appendicitis, tonsillitis 124 ive having nature of attractive, active 961 ize to make pasteurize, motorize 637 less without motionless, careless, childless 282
let small starlet, eaglet 185 ly like, in a manner happening heavenly, remarkably, suddenly every absolutely, monthly 5440 ment state or quality act of doing accomplishment, excitement placement, movement 680 meter device for measuring thermometer, barometer 166 ness state of blindness, kindness 3322 ology study of geology, zoology, archaeology 374 ous, ious full of joyous, marvelous, furious 1615 ship quality of or state of rank of friendship, leadership governorship, lordship 214 scope instrument for seeing telescope, microscope 79 some like tiresome, lonesome 83 tion, sion action, state of being condition, attention, fusion 3111 ty quality or state of liberty, majesty 2630 ward toward southward, forward 111 y like, full of action of diminutive, endearing noisy, sooty, jealousy inquiry kitty, Billy 5440
patron patronage patroner patronize
patronery
patronist patronery patrondom patronacy patronhood patronish patronship patronlet