1. Function length being 2 is great, but unnecessarily breaking it down isn't always useful, you have to think of readability too 2. Return from the function when the jobs done 3. In a func, define variables when you are about to use them rather than defining them all at the top 4. Use variable name as _ or ignored when you want to ignore a value 5. Use meaningful func/variable names 6. Explicit returns are better than implicit returns 7. Don't forcefully implement a new feature that you just learnt
I'm a big big fan of Jack's "Stop Writing Classes" and it's great to find another talk up to the standard of that one... both these talks apply to the other languages as much as they do to Python too.
types are useful for code that will change, or code that other people will use later. I once came into a plain javascript rest API and i had no idea what data was passed around to what functions. I had to read nearly the entire codebase to safely make changes. Typescript gives you this information directly, as well as providing information about what will break if you make a change. Just change something, and click the compiler error links that show up in the console. Types aren't as much about the code that you write, as they are about the code you and others WILL write or change in the future when you have forgotten about it.
I didn't understand what he meant in one of the examples of "The gun in the mantle" bit @15:30 . def call_api(retries=MAX_RETRIES): Did he meant to we should avoid using variables for keyword arguments? If so we lose a bit of the semantics by adding a constant directly on the code, and I don't think that's a good practice for easier code review.
What he was saying is don't pre-define all of your variables up front - if you know 1/2 way down you have a loop which does a partial_sum of the input, don't define your sum variable at the top of the function. you should set your sum to zero literally just before the loop.
and if there is 3 configs with the same name? you will all 3 configs, he say'd that if there a config with 2 same name we need to return error, because something go wrong
Ga men not OP and I know this is a year late. Personally I like the new annotations for code completion in my editor. If I tell it what input type I am expecting for a variable I can quickly access methods for that type.
my man on the podium just said "I don't pass the wrong types in my functions", which made my head spin. That's like saying "I don't make mistakes". Type annotations make your code infinitely more readable, and it complements unit tests in a way that nothing else can. Here's a talk from the same pycon: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-pMgmKJyWKn8.html