#100DaysOfCode in Python Transcripts
Chapter: Days 34-36: Refactoring / Pythonic code
Lecture: Refactoring / code quality resources
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
In this video I'll provide you some extra resources to read up about refactoring and how to make your code more Pythonic.
0:09
Read about the topic of refactoring, we have a whole dedicated post on the importance of refactoring code.
0:16
Errors should not pass silently, as we've seen. So a lot of this we've discussed in this notebook, but it shows you some more examples.
0:25
This is an important one, there's some Python mistakes the beginner is likely to make. And we listed them here so you can know about them in advance.
0:35
There's string formatting we discussed and Julian had a very nice article here. From going from the terribly un-Pythonic method to the nicer way.
0:46
And I think he come to the same conculsion that you really want to use f-strings if you can, if you're on 3.6.
0:53
There's an awesome talk about beautiful idiomatic Python, by Raymond Hettinger. I learned a lot from this talk,
1:00
there's a lot of good tips and tricks in it. And we've made a summary in this blog post. And when we talk about modules, and splitting your code,
1:09
it becomes important to know about packaging your code. So here we have a post about how to do that on a practical project, like her Karma Bot.
1:18
And it's not that hard, I mean basically you have to make an init.py file and know how to import your stuff. That's important.
1:26
The imports mights be confusing, but with this article it should become clearer. So when we're talking about splitting code
1:33
and making it maintainable, know how to work with modules and packaging is important. And generic code quality resources, I have two.
1:42
First of all Martin Fowler's Refactoring Book, and yes, the examples are in Java, not Python. But it's about the general principles.
1:51
And this book really teaches you how to write better code. It shows you very practical examples how you can refactor bad code
1:59
into much more maintainable code. It's a great read. And of course, Uncle Bob's Clean Code, a classic. And also shows you a lot of ways
2:09
to write professional quality code.