Super Quick Python Refactoring Tips

preview_player
Показать описание
In this Python Tutorial I show you another 8 quick Python refactoring tips for cleaner and more Pythonic code. This is part 2 of my refactoring code series.

Get my Free NumPy Handbook:

📓 ML Notebooks available on Patreon:

If you enjoyed this video, please subscribe to the channel:

~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

#Python

----------------------------------------------------------------------------------------------------------
* This is an affiliate link. By clicking on it you will not have any additional costs, instead you will support me and my project. Thank you so much for the support! 🙏
Рекомендации по теме
Комментарии
Автор

Small correction: In Tip 7 it should be - if currency in {"USD", "EUR"} - to use a set. So it must be curly braces and not parenthesis. Hope you enjoyed the video!

patloeber
Автор

"We should be always searching for opportunities to remove duplicated code" - now I know you're like me :) thanks for the tips!

inLofiLife
Автор

2:00 don’t rely on enumerate’s counter variable outside the loop, because an empty argument will lead to a NameError, as the counter assignment is never executed. I have been burned by this in the else block.

DrDeuteron
Автор

Hi. Nice tricks

I was trying 03:52 before I watch it :D

currencies = ["USD", "EUR"]

def process_payment(payment, currency):
if currency in currencies:
print(f"Payment: {payment} and currency is: {currency}")
else:
print(f"Global: {payment}")

Thanks ^_^

bosadam
Автор

4:00: values are in a tuple/() not in a set/{}. Did you mean tuple or set actually?

fullstackspiderman
Автор

Dam, That's good. Look forward for more such videos

learnwithraghuIT
Автор

amazing video...! please do more videos like that with refactore code, "code smell" I learn a a lot from that. and BTW the AI tool is nice... I you know more like this please let us know (:

shaishai
Автор

4:00 Isn't a set in Python initialized with curly braces?

wilsvenleong
Автор

Nice tips, thanks. could you please do some python code implementation for the Passive-aggressive algorithm for the multiclass classification case?

tigrayrimey
Автор

For tip #7, I would do like this so I don't need if's:

payment_types = {"USD": process_standard_payment, "EUR":

def process_payment(payment, currency):

ulissesalvesoffsec
Автор

Tip 7. When checking if character is in string, should I convert a string into set?

ІванДмитренко-хэ
Автор

Except “is_winning” is undefined.. so assuming most people would try these in repl and find them not to work, why not come out with better example?

MrEo
Автор

where's tip no.0?
index not starting with 0?

sangchoo
Автор

Tip number 1 xD? For those people that cant tie their shoes.

Fishu
Автор

tip number 1 is not even tip. 🧐 that's how people declared list.

Batman
join shbcf.ru