Here is a glossary for Python programming definitions.Learn a meaning of a term here.
Learn game programming through our video tutorials here.
Game programming terms and tutorials
"Python programming definitions explained"
Argument:The part of a statement that Python will operate on.For example,in a print statement,the text that will actually be printed to the screen is the argument.
Example---->print"hello world!"The "hello world" text statement is the argument that Python will operate on.
Comment:A comment is a specially marked element(looks like this #) in a program that is ignored by Python.Comments are useful for explaining what you're trying to accomplish.
Compiled Language:In compiled languages,the code is translated completely into a machine-readable format before it runs.In general,compiled languages are faster-running programs,but interpreted languages can be more flexible.
Console:A text based interface.You can interact with Python at DOS or UNIX shells in a console mode.
Docstring:A unique text value that happens at the beginning of a Python program.Docstrings are used to create the automatic documentation for the program,and they are usually multi-line string.
IDLE(Interactive Development Environment):A simple-but-potent text editor and Python environment that comes with most versions of Python.
Interactive Mode:A special way of interacting with the Python environment.When you use interactive mode,you type the commands directly into Python rather than storing them in a text file.Interactive mode is useful for quick code checks and accessing the online help system.
Interpreted Language:An interpreted language(such as Python) is one translated from a human-like dialect into machine-readable code in real time.Programs written in an interpreted language cannot run unless the user also has the interpreted program installed on the same system.Interpreted languages can be slow,but the programmer can interact with with them in real time.The alternative to an interpreted language is a compiled language(such as C+).
Method:Something an object knows how to do.For example,Python's built-in string object has a method to convert to lowercase(string.lower()).
Object Oriented Programming:A form of programming that allows the programmer to organize code in objects much like those in the real world.Most built-in Python elements(variables,lists,etc) are objects.
Pygame:A module that adds game-programming functionality to Python.
Python:An interpreted language designed to be powerful yet simple for beginners.
Slicing:Using the square braces() operators to pull a subset of a string or list.
Statement:A command or line of code in a programming language.
String:A variable containing text.
String Interpolation:A technique for embedding(or enclose firmly) variables into a string for easy formatting.
Syntax:A programming language's rules of grammar and punctuation.
Tuple:Values inside parentheses,separated by commas.The elements can't be changed.
Variable:A variable is a reference to a specific place in a computer's memory meant to store information.Each variable has a name and value.
Data Type:What kind of data a variable contains.Even though Python automatically assigns a data type to every item of data,the programmer has to know what type a variable is because each type has different methods associated with it.
Debugger:A special program that allows you to view your program one line at a time and watch what it's doing.IDLE has a debugger built in.
Dynamically Typed Language:A programming language that allocates data types automatically as the programmer assigns values to variables.Python is dynamically typed.
Float:A floating-point real number.
For Loop:A programming structure that repeats code once for each element of a list.Use the range() function to make the code repeat a certain number of times.
Example---> for i inrange(2):
print"I love woodstock production!"
I love woodstock production!
I love woodstock production!
I used the range(2) function to make a list with two elements and repeat the line "I love woodstock production!" two times in a row using the for loop to step through the (two elements) list.So the line is repeated once for every element in the list.
Integer:A number without a decimal part.
List:A variable containing multiple values.
Operator Overloading:A mathematical operator sometimes does different things on different data types.For example,an operator will concatenate(combine) string data with the plus sign(+),but it will add integers and real numbers with a plus sign(+) as well.
Real Number:A number that can include decimal values.Real numbers can be referred to as floats.
String Concatenation:Combining two strings to make a larger string.This can be done with the plus sign(+).
Boolean Variable:A variable containing either True or False.Boolean variables are often used to make main loops easier to follow.
Condition:An expression that can be evaluated to True or False.Can be compared to a Boolean value or something else that Python can interpret as a Boolean value.
Encapsulation:The concept that functions can be used to conceal(hide) details from the main program,making the program easier to read and maintain.
Equality Operator:Checks to see whether two values are equal.Use the double equals sign(==)to see whether two values are equal to each other.
Example--->lastName=raw_input("what is your last name?")
if lastName == "woodstock":
print"Hi jason woodstock!"
what is your last name?woodstock
Hi jason woodstock!
This example asks the user a question on what is their last name.I used an if statement to indicate a condition(if lastName == "woodstock").Whatever the user types to respond to the question,that value will equal the lastName variable. If the user types in woodstock as a response to the question on what their last nameis,then the lastName variable will equal woodstock and the user receives a greeting(Hi jason woodstock!)
Function:A subprogram that works by itself to solve a specific problem.
Global Scope:A variable declared outside any function.The variable's value can be read from any function.
Local Scope:A variable created inside a function is considered local to that function.The variable has a value only as long as the function is running.
Main Loop:Most programs have a primary loop that controls how long the program runs.This loop is usually some form of a while loop.Main loops often have a plethora(many)of exit points,so they are best controlled by a Boolean sentry variable.
Parameters:When you define a function,you can indicate a number of variable names inside the parentheses behind the function's name.These variables become local variables when the function is called.When you call a function that has parameters,you must supply a value for every parameter.
Self-Documenting Code:Code designed to be as easy to read as possible.You can make your code self-documenting by choosing your variable names carefully and making your code as straightforward as possible.
Sentry Variable:A variable which controls access to a loop.Sentry variables must be properly initialized,must be part of of the condition,and must be changed inside the body of the loop.
Shortcut Evaluation:If you have a prolific amount of conditions chained together with a series of elif statements,Python exits the chain as soon as it finds the first True condition.This means the order in which you place the conditions can be very important.
Example----> firstName=raw_input("what is your name?")
if firstName == "Jason":
print"Hey Jason Woodstock!"
elif firstName == "Mark":
print"Hello Mark.Where's Jason?"
what is your name?Jason
Hey Jason Woodstock!
I made python asks the user for its name using the raw_input() function and then setup two conditions.If the user types in Jason as their response,then the user gets "Hey Jason Woodstock!".If the user types in Mark,then the user gets "Hello Mark.Where's Jason?". The user then types in Jason as their name and python greets the user with "Hey Jason Woodstock!",but ignores the other condition that I set up if the user types in Mark.Python exits the program as soon as the first condition's value is True and this is known as shortcut evaluation.
Variable Interpolation:A technique for putting many kinds of data into a string,which allows automatic conversion and formatting.
Variable Scope:The notion that variables only have value within some block of code.
Application Programming Interface(API):A set of programming tools that allows you to add functionality to a programming language.
Blit:Short for block transfer,this technique for copying one surface to another is used to draw surfaces onto the screen.
Display:A special pygame module used to control the screen display hardware.Usually referred to as pygame.display,its most important functions are pygame.display.set_mode() and pygame.display.flip().
Double Buffer:All image manipulation is done on a secondary surface that resides only in memory,and the entire surface is copied onto the display screen in one special,high-speed blit.Double buffering makes the display smoother and faster.Use the pygame.display.flip() function to use double buffering.
Event:Some kind of stimulus that the user sends to the game through the keyboard,mouse,or joystick.
Event Buffer:A special list that contains all the events that have occurred during the current frame.Use pygame.event.get() to retrieve the event buffer.
Frame Rate:The basic speed of your game.Python games usually run 30 frames per second.
Game Loop:Sometimes referred to as an animation loop,the game loop is the logical structure that manages what happens during each frame.
Module:Python's tool for adding functionality.Python comes with several useful modules(like pygame, for example).In order to use the tools in a module,you need to import it.
Pixel:The basic graphical unit of a computer display.A pixel can produce colors by varying the amount of red,green,and blue in the light it emits.
Rect:A data structure representing a rectangle.Every surface has a rect associated with it,as do many other graphical objects in pygame.
Resolution:The number of pixels used in a game.Usually specified by width and height.
Simple Direct Media Layer(SDL):A multi-platform graphics API used by pygame to simplify graphics and game programming.
Surface:A pygame object that represents a rectangular image in memory.
Tuple:A python structure much like a list but with fewer capabilities.Used within pygame to manage color values and screen coordinates.
I used the fill() method of the surface object to create a single-color surface that is black.The tuple (0,0,0) represents the color black.Python uses a three-number system to define colors.
Widget:A graphical element like a button or list box.
Constant:A variable that is not meant to change as the program runs.Constants are often used for clarity and are written entirely in uppercase.
Font:A combination of typeface with size.Pygame has an object for the font to be used in computing to refer to a file containing typeface information(using the pygame.font.Font() or pygame.font.SysFont() function).
Immutable:Certain data types(strings and tuples for example) are immutable.This means assignment is the only way to change them.
Keyboard Constants:A series of keyboard names stored in the pygame module.They usually begin with K and contain the letter or key name(for example,pygame.K_ESCAPE or pygame.K_b).
Radian:The length of a circle's radius inscribed on the circumference of the circle.
Typeface:The characteristic shapes of whole sets of letters.
Attribute:A characteristic of an object.In python classes,attributes are usually defined with self.attributeName in the classes' __init__() method.
Bounding Box:The smallest box with horizontal and vertical sides that surrounds a sprite.Used in collision detection.
Class:A template or definition for creating instance objects.
Class Module:A file containing multiple class definitions.Can be loaded with import statement.
Color Key:A color that is designated as transparent.Any pixels that are this color will not be drawn,and the background will be shown instead.
Constructor:A special method called when an object is created.In python,use the initializer __init__() to act as a constructor.