#100DaysOfCode in Python Transcripts
Chapter: Days 34-36: Refactoring / Pythonic code
Lecture: Lesson introduction
0:00 Welcome back to the 100 Days of Python.
0:02 In the coming 3 days I will guide you
0:04 through refractoring and writing Phythonic code.
0:08 One thing is to write Python, the other thing
0:10 is to really leverage all the great stuff Python has.
0:14 The Zen of Python states there should be one
0:17 and preferably one way to do something,
0:20 and that's great because in Python there usually is one best
0:24 way to something, and the more you know these constructs
0:27 and idioms, the more readable and elegant
0:30 your code will become.
0:31 For this lesson I've prepared a Jupyter notebook
0:34 with 10 practical examples how you can improve your code.
0:38 For example use a with statement
0:40 instead of a try, accept, finally block.
0:43 Or use enumerate to not keep a manual counter
0:47 or what about refractoring a long if,
0:50 elif else statement using a dictionary.
0:53 We will touch upon list comprehensions,
0:56 generators, using explicit is better than implicit
0:59 in your exceptions, string formatting, tuple unpacking,
1:03 PEP 8, the Zen of Python, and even some common
1:06 best practices writing maintainable code.
1:09 And for day two and three I have you refractor
1:12 your code or the code of somebody else
1:14 to really put into practice what you've learned.
1:17 So there's a lot to cover, I'm really excited.
1:19 Let's dive straight in.