Write Pythonic Code Like a Seasoned Developer Transcripts
Chapter: Modules and Packages
Lecture: Introduction to packaging and module idioms
0:01 Python is often referred to as a programming language and ecosystem
0:04 with batteries included, and on one level
0:06 that means it has a really rich standard library.
0:08 Things like the json module that's built in and so on.
0:11 It also means looking at the larger ecosystem
0:14 all the 80 000 packages on PyPi, things like that,
0:18 so in this section we are going to focus
0:21 on the Python idioms around packages, modules,
0:24 importing them, creating them, those kinds of things.
0:26 I want to give you just a little bit inspiration before we get to the technical details
0:30 so if I come over here and run Python 3, and I go type in import,
0:35 I could say import json things like that,
0:37 and then I could say json.dumps given a dictionary and so on,
0:41 right, json.dumps here a is 1 and boom, we have json,
0:46 but we could also import all sorts of things,
0:49 we could go to PyPi install some packages and import them
0:52 for example I could import requests because I've installed that somewhere,
0:56 to capture this idea of how amazing packages are,
0:59 we have this concept of import antigravity,
1:02 so what happens if I import antigravity- well something pretty awesome,
1:05 it pulls up this xkcd about why Python is awesome
1:09 because you can import anything
1:11 so here I'll just read it to you really quick,
1:13 so we have this guy up here he is totally flying and his friend says,
1:16 "Dude, how are you flying?""
1:19 "Python, I just learned it last night everything is so simple,
1:21 hello world is just print hello world"
1:23 "I don't know man, dynamic typing white space",
1:27 "Come on, join us, programming is fun again, it's a whole new world up here"
1:30 "But how are you flying?"
1:32 "I just typed import antigravity", "That's it?"
1:33 "Well I also sampled everything in the medicine cabinet for comparison,
1:36 but I think it's the Python".
1:38 This is the feeling you should have as you think about packages
1:41 and modules and all the stuff that you can do,
1:44 let's talk about the idioms about consuming all these amazing packages.