Write Pythonic Code Like a Seasoned Developer Transcripts
Chapter: Welcome to the course
Lecture: Topics covered
0:01 What areas are we going to cover in this class?
0:03 Well, we are going to start with the foundations and this concept called pep 8.
0:06 So, pep 8 is a standardized document
0:09 that talks about the way code should be formatted,
0:11 and even some of the Pythonic ideas and Pythonic code examples.
0:15 However, we are going to go way beyond pep 8 in this course,
0:19 and so we'll probably spend 15 minutes talking about pep 8
0:22 and then we'll move onto other foundational items.
0:25 Then we are going to focus on dictionaries,
0:28 dictionaries play a super important role in Python,
0:30 they are basically the backing store for classes,
0:34 they are used for data exchange all over the place,
0:37 and there are a lot of interesting use cases and ways
0:40 in which dictionaries are used in a language.
0:43 We are going to talk about a lot of interesting aspects
0:45 and optimal ways to use and leverage dictionaries.
0:48 Next up are working with collections,
0:51 things called list comprehensions and generator expressions.
0:55 And we'll see that Python has a lot of interesting flexibility
0:58 around working with sequences,
1:01 and we'll see the best way to do this here.
1:04 Next, functions and methods.
1:06 This will include the use of things like lambda expressions for small inline methods,
1:11 as well as returning multiple values from methods and that sort of things.
1:14 There is a lot to look at to write Pythonic functions.
1:17 One of the great powers of Python
1:19 is the ability to import or pip install a whole variety of packages,
1:25 there is even a great xkcd cartoon about importing packages in Python,
1:31 and we'll see that there are a lot of interesting Pythonic conventions
1:33 around working with packages and modules.
1:36 Next up, we are going to look at classes and objects.
1:40 Object oriented programming in Python is a key corner stone concept,
1:44 even though it may play a slightly less important role
1:47 than languages like Java and CSharp,
1:50 still, classes are really important
1:52 and there is a lot of idiomatic conventions around working with classes,
1:55 we'll focus on that in this section.
1:57 Python has a lot of powerful ways of working with loops,
2:01 one of the first giveaways if somebody is brand new to Python
2:04 is they are not using loops correctly,
2:07 so we'll talk about when and how you should use loops
2:10 and we'll even talk about the controversial else clause
2:12 for for in and while loops.
2:14 Next, we'll talk about tuples.
2:16 Tuples are smallish, read-only collections
2:18 that let you package up related possible heterogeneous data
2:23 and pass it around,
2:25 If we go into a basic database queries and the built in db api
2:28 you'll see that the rows come back as tuples.
2:31 Some of the powerful techniques we'll learn about loops involve tuples
2:34 and we'll see that tuples in general play a really important role,
2:37 and there is some powerful and useful conventions
2:40 around working with tuples in Python.
2:42 Finally, we are going to look beyond the standard library,
2:45 with something I am calling Python for Humans;
2:47 one of the great powers of Python is the ability to go out to PyPi
2:51 and grab one of the over 80 000 packages,
2:54 install them using pip or something like this
2:57 and add amazing powers to your application.
3:00 People who are new to Python often skip this step
3:03 and they look at something they have to do and are just like
3:07 ok I think I can implement it in these 20 lines of code.
3:10 It's very likely that there is already a package out there
3:14 that you can use to do this,
3:16 so we are going to study two packages one for http
3:18 and one for database access to really bring home this point of look to PyPi
3:24 and look to open source first before you start writing your own algorithms.
3:28 Of course, over time, we may add more topics than what are described here,
3:32 I am sure as more and more people take this class they will say,
3:35 "Hey Michael, did you think about having this",
3:38 or "I also consider this little bit to be idiomatic."
3:40 Now I don't want to just grab every single detail that I can find,
3:44 that is possibly Pythonic code and cram it in here,
3:48 I want to cover the stuff that's most important and not waste your time,
3:50 but of course, I am sure we'll hear about some new ones
3:53 that are great and those may be folded in over time.