Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Python's scoping rules pretty much free you from the need to use different or identical names for variables just to satisfy language needs.</p> <p>Variable name choice should be driven primarily by readability and maintainability concerns. In general, it is good to use just one name to identify a particular kind of thing throughout the code. This kind of consistency is helpful to readers. Naming variables, methods, and classes is one of the biggest tools you have to make your intent clear---to both yourself and others.</p> <p>There is a large (and not entirely consistent) literature about naming things. A couple of things to consider:</p> <ol> <li>Names with small scopes can be short names that do not necessarily tell the whole story about the variable, since the entire context for the variable is easily visible. i,j,k as counters in loops are maybe the classic example---but you don't see that much in Python with its dandy for item in collection loop construct.</li> <li>The flip side of this is that names with larger scopes (instance variables in a class, maybe) should have more completely descriptive names, since they show up in places where the initialization/modification context is not visible.</li> <li>Try not to put 'noise' pieces into your names. frequencyInfo---what, exactly does the Info part add to things?</li> <li>Don't include the data structure type in the name---the dict in urldict doesn't really help you much.</li> <li>Use names from the domain you are working in when you can, but don't force it.</li> <li>Python style leans towards terse names. Careful thinking and choices often result in a name that is brief, but apt.</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload