- Yes, we are playing with Class.
- Are you sure when you should define variables?(before/after _init_?) This is called Instance variable versus Class variable.
- Inheritance: Father and child. Children can override father’s method.
- So WHY? We want 1) no need to deal with tons of functions 2) make a “wrapper” method for lots of works 3) similar Classes, same method
- Python is a week type language: the type of variable can be changed on the fly.
- I mean…why copy your code for several times for doing the same thing?
- Because no one would remember what the heck he had done 2 weeks ago
- Also, people are forming groups to getting jobs done: think about popular open-source softwares.
- Enable you to use the same stuff multiple times later
- We want to organize the inputed data.
- Putting data into your machine feels good: taking them out can be pain in the a*s.
- If you happen to need to sort your stuff or find something…
- We focus on its behavior.
- Don’t focus on its name: I can name my cat “puppy” , but it won’t bark.
- This part of A48 is actually called “Data Structure”.
- No this is NOT a common ADT.
- You can implement a Queue with a Doubly Linked List(DLL).
- Wanna play with enqueue/dequeue/peak/isempty/len/etc.
- Yes you can handle exceptions in the code;
- But maybe you just want to exit the function.
- Exceptions are not equal to ERRORs: it only matters how you handle it.
- Make sure you are catching the RIGHT one and ENOUGH ones. Names are important.
- A pure except would catch everything. But is that what you want? You really want to include KeyboardInterrupt?
- Objects: Nouns.
- Methods: Verbs.
- Attributes: Variables.
- Said Nick.
- If you do not understand it…how did you wrote your DocString?
- You want to include the above 3 stuffs, linked.
- Can become a Queue, Stack…or a branch of a Tree!