1. expression ends
not use ; to end one sentence, it just like marco define in c++
2. block of codes
use : to perform the same function as {} in c++ define of block of codes
3. object construction
use function: __init__
def __init__(self):
def __init__(self, parameter = default_value, parameter = default_vaule):
4. operator overidding
def __add___(): ------------- add/radd
sub, mul, div, pow etc.
5. logical operators
and, or, not
6. name restrictive
start a letter or an underscore, follow any-length letter, number, underscore
7. import a name.py file
>>> from
name import * ----------- just as has type the name.py into interpreter
note: not the name.py
This statement imports all the de nitions from
name and places them into the global scope
>>> import name
This creates a new scope that is separate from the global scope (but is enclosed by the global scope)
8. build_in function print()
print(parameter, parameter, sep="value", end="value")
sep is the value used to seperator the parameters(the default value is a space ), end is the value used to put at the end when print the parameter done(the default value is newline)
9. class's __mro__ attribute
list the order of based class that the class inherited
10. _
in interactive session, the _ means the result of last operation