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, 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. This section we are going to look at two separate external packages
0:16 and how simple and lovely they make it to work with certain types of data and we are going to do this because it really is meant to be a stand-in
0:23 for look at open source, look at PyPi and look to the community and ecosystem before you start working on your project
0:32 for all the things that you can build your project from. There is an amazing set of lego blocks out there 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 implement this bit?" of whatever subsystem you are working on in Python,
0:46 stop and do a little research first. For example, if you are going to work with user accounts, and you need to store user names and passwords,
0:54 you hopefully know that you should hash those passwords. Did you know you should use separate salt per user to go into hashing their password?
1:03 Did you know that you should fold that hashing over and over and over again to make it computationally difficult?
1:09 Not five times or ten times but something like a hundred thousand times. So if you are thinking oh my gosh, this is going to be a lot of work,
1:15 that's one way to think about it, the other one could be "oh, there is a really great library for exactly that thing called passlib", go grab that, OK?
1:22 So when we look at these two packages yes, it's great that you know about them, 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 to work from you really should start there.
1:38 Right, so the first place to look is probably PyPi, the Python package index and you can see at the time of this recording,
1:44 there is 82 000+ packages there, so about 300 new unique packages a day, and the power of what's available here really is the main reason
1:54 why Python is popular. Another really important place to look for Python libraries and tools is of course GitHub.
2:01 So there is this really cool site called GitHut.info, let's check that out quickly. So here you can see, these are all the popular languages on GitHub,
2:11 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 and it tells you all sorts of things,
2:20 so for example we could compare say Python to C#, to Ruby and you can see that Python is more popular than Ruby, way more popular than C#,
3:02 look to PyPi for your packages and your features before you just write the whole thing from scratch, remember, Python comes with batteries included,
3:11 these two places are often where you find those batteries.