Python Flashcards
'
Single quote
\
Single backslash
"
Double quote
\a
ASCII bell (BEL)
\b
ASCII backspace (BS)
\f
ASCII formfeed (FF)
\n
ASCII linefeed (LF)
\N{name}
Character named name in the Unicode database (Unicode only)
\r ASCII
Carriage return (CR)
\t ASCII
Horizontal tab (TAB)
\uxxxx
Character with 16 bit hex value xxxx (Unicode only)
\Uxxxxxxxx
Character with 32 bit hex value xxxxxxxx (Unicode only)
\v
ASCII vertical tab (VT)
\ooo
Character with octal value ooo
\xhh
Character with hex value hh
class
Tell python to make a new kind of thing
object
The most basic kind of thing, and any instance of some thing
instance
What you get when you tell python to create a class
def
How you define a function inside a class
self
Inside the functions in a class, self is a variable for the instance/object being accessed.
inheritance
The concept that one class can inherit traits from another class
composition
The concept that a class can be composed of other classes as parts
attribute
A property classes have that are from composition and are usually variables.
is-a
A phrase to say that something inherits from another
has-a
A phrase to say that something is composed of other things or has a trait
classX(Y)
Make a class named X that is Y
class X (object): def init(self, J)
Class X has a init that takes self and J parameters
class X(object): def M (self, J)
Class x has a function named M that takes self and J parameters.
foo = X()
Set foo to an instance of class X
foo.M(J)
From foo get the M function, and call it with parameters self, J
foo.K = Q
From foo get the K attribute and set it to Q