Every Python function returns a value, if the function ever executes a return statement, it will return that value, otherwise it will return None
.
Everything in Python is an object. Strings are objects. Lists are objects. Functions are objects. Classes are objects. Class instances are objects. Even modules are objects.
Python uses carriage returns to separate statements and a colon and indentation to separate code blocks. c++ and Java use semicolons to separate statements and curly braces to separate code blocks.
Python uses try...except
blocks to handle exceptions, and the raise
statement to generate them. Java and c++ use try...catch
blocks to handle exceptions, and the throw
statement to generate them.
All names in Python are case-sensitive: variable names, function names, class names, module names, exception names. If you can get it, set it, call it, construct it, import it, or raise it, it's case-sensitive.
网友评论