Day 14: 2018/05/09
Today’s Topic: Python: Generic
Today’s Progress: I finished PEP8 and the extended style guide.
Thoughts: After reading PEP8, some of my previous questions (like how to import) are solved. I now know when I started, I had some questions, and that’s normal. You might find your answers after a while (when you get to it.) I don’t have to rush into it, but it’s also good if I can find the answer somehow.
- something = x*2 + y ← space for the lower priority operators
- What’s the difference between “parameter” and “argument”?
The parameter is what’s given in the function declaration/definition/prototype, An Argument(Actual argument) is what’s passed when calling the function, an instance of a parameter. (extracted from here.)
- need to be careful where the underscore is: how many they are, before or after and what they mean etc.
- if foo is not None: better than if not foo is None:
- if isinstance(obj, int): better than if type(obj) is type(1):
- Contradicts to my own believe:
Rarely create your own exception types
- use reST docstrings
- good_names + explicit_defaults > verbose_docs + type_specs
- You should usually prefer functions to classes
- TODO: iterator and yield
- TODO: read the best practice for stdlib
Link to work: N/A