Write Pythonic Code Like a Seasoned Developer Transcripts
Chapter: Python for Humans
Lecture: Human Python as a stand in for packages in general
0:01 Let's round out the course with a little bit of Python for Humans,
0:05 and that's a bit of a play in words from some of the most popular
0:08 open source projects that really add power to Python.
0:11 This section we are going to look at two separate external packages
0:15 and how simple and lovely they make it to work with certain types of data
0:19 and we are going to do this because it really is meant to be a stand in
0:22 for look at open source, look at PyPi and look to the community
0:27 and ecosystem before you start working on your project
0:31 for all the things that you can build your project from.
0:34 There is an amazing set of lego blocks out there
0:36 all you have to do is know to reach for them.
0:39 So if you find yourself thinking hm, how am I going to
0:42 implement this bit of whatever subsystem you are working on in Python,
0:45 stop and do a little research first.
0:48 For example, if you are going to work with user accounts,
0:50 and you need to store user names and passwords,
0:53 you hopefully know that you should hash those passwords.
0:57 Did you know you should use separate salt per user
1:00 to go into hashing their password,
1:03 did you know that you should fold that hashing over and over and over again
1:06 to make it computationally difficult,
1:08 not five times or ten times but something like a hundred thousand times.
1:11 So if you are thinking oh my gosh, this is going to be a lot of work,
1:14 that's one way to think about it, the other one could be oh,
1:17 there is a really great library for exactly that thing called pass lib, go grab that, ok.
1:21 So when we look at these two packages yes,
1:24 it's great that you know about them,
1:27 but the most important takeaway is not the details of the two packages
1:30 we are going to focus on, but really the concept of there are so much out there
1:33 to work from you really should start there.
1:37 Right, so the first place to look is probably PyPi,
1:40 the Python package index and you can see at the time of this recording,
1:43 there is 82 000+ packages there, so about 300 new unique packages a day,
1:49 and the power of what's available here really is main reason
1:53 why Python is popular.
1:55 Another really important place to look for Python libraries and tools is of course github.
2:00 So there is this really cool site called githut.info, let's check that out quickly.
2:05 So here you can see these are all the popular languages on github,
2:10 and here is their active repositories, the total number of pushes, number of forks,
2:15 how recent it was, what year it appeared and you can actually hover over these
2:18 and it tells you all sorts of things,
2:20 so for example we could compare say Python to CSharp, to Ruby
2:25 and you can see that Python is more popular than Ruby, way more popular than CSharp,
2:30 anyway, github is such a central part of modern software development
2:34 and look where Python lives, we have Python,
2:50 the PHP websites, the Ruby websites, the CSharp websites, and so on,
2:58 Python is either 3 or 2 on this list, so certainly, look to github,
3:01 look to PyPi for your packages and your features
3:05 before you just write the whole thing from scratch,
3:08 remember, Python comes with batteries included,
3:12 these two places are often where you find those batteries.