Boston Python workshop 2/Glossary

From OpenHatch wiki
Jump to navigation Jump to search

argument or parameter - The values or variables that a function uses. For example, when you say 'print "Hello, World"' the argument to the function 'print' is '"Hello World"'. Many functions can have multiple arguments, and you can use variables or values are arguments.

conditional - a piece of code that choose which code should execute next based on a test that compares various values or variables. An "if" statement is a type of conditional, as is the part of a loop that decides if we should keep looping or not.

dictionary - A variable type that allows the programmer to represent relationships between a key and a value. You can think of a key as the word in a traditional dictionary, and the value as the definition of that word. A dictionary can have many keys and values, but a key only looks up one value.

exception - a unique event, often an error of some kind, that may occur in code. Sometime you can't predict how or if a function will fail to run properly, so you make that function throw an exception and this way the programmer who uses that function can catch the exception by writing some code around the call to your function.

function - a self-contained bit of code that can be used by other code. For example, "print" is a function in Python that you use to write text to the screen. You may here someone say "call the print function" or "make a call to the foo function". call is another way to say "use" when you are talking about a function.

iteration - each time you go through the code in a loop you are iterating through the code inside the loop. This is just a programmer's way of saying "repeating" or "repetition".

library or module - a collection of useful code that is grouped together and usable by other programs. You can also think about this as a collection of related functions that another programmer has written so you don't have to. For example, in the ColorWall program we use the "Tk" module to draw pictures on the screen; we didn't write the Tk module but we're able to use it in our program. As you get better at Python you'll make your own modules for you and others to use.

loop - code that executes over and over again until some condition is met. These the 'for' and 'while' loops in Python.

syntax - the words and symbols that make up a programming language, such as 'if', 'else', 'for', 'while', '+', '-', etc. When you see a "'syntax error'" it means that you've tried to use a word or symbol that isn't part of the programming language (or use a word incorrectly), or you've just spelled something wrong.

text editor or editor - Like a word processor for doing software development, this is the tool in which you edit your code. While Windows comes with a text editor called Notepad, Notepad doesn't have some of the advantages (such as syntax highlighting and the ability to run your program inside the editor) of other text editors. Some examples of text editors are Notepad++, TextPad, Nano, Emacs, and Vi.

type - The type of a variable defines what kind of values the variable can be expected to represent. For example, if a programmer says "variable foo is of type string" it means that the variable 'foo' will have some words inside of it.

variable - a word (of your choosing, that isn't already used by the programming language's syntax) that can be used to represent a value. You can create variable with no value, or create them with an initial value, and you can change those values later in your program.