The True Power of 'defaultdict' in Python

preview_player
Показать описание
In today's video we're going to be learning how we can use defaultdict in Python.

▶ Become job-ready with Python:

▶ Follow me on Instagram:
Рекомендации по теме
Комментарии
Автор

I never thought I would hear Indently saying "yo mamma"

foxypiratecove
Автор

dict.setdefault: «am I a joke to you?»

JustThatRandomTroll
Автор

def Tree():
return defaultdict(Tree)

t = Tree()
= 'a'

eliavrad
Автор

defaultdict is so useful, I've gotten annoyed at some other languages when their version of a dictionary didn't have an equivalent.

swolekhine
Автор

4:41 Isn't the f-string overkill here?

foxypiratecove
Автор

If you try to access a key without adding it to this dictionary, is that key implicitly added (with the default value) or not?

watchmakerful
Автор

2:04 That's not actually a cast, it's creating a new dict from the defaultdict

TheJaguar
Автор

Hi there - one thing I use dictionary defaults (I usually use the get function of.a regular function) is for a translation from one representation to another. Often only a few words need to be translated - so the default is the key. For example "american_words={'colour':'color', 'honour':'honor'} then "new_word = american_words.get(word, word)". Is there a way to do this with default_dict?

SimonChang-te
Автор

defaultdict is so invaluable. It's not uncommon for me to subclass defaultdict to override __missingkey__ so that I can use the key in the creation of the default value.

TheJaguar
Автор

Calamansi (whatever that is - even spell checked did not know it) example works very well with dict() instead of defaultdict()

sseymour
Автор

The true power of defaultdict is allowing you to circumvent your professor’s “No dictionaries” restriction, since it is not a dict = {} 😆

ChalcolithicPrizim
Автор

Python flet framework project convert to android apk plzz provide tutorial

TRADINGPULSE
Автор

5:00
dict(zip(los, map(str.upper, los))
is mo' better.

DrDeuteron
Автор

C'est horrible la voix IA dégueu pour le doublage

MapsCharts
Автор

holy crap auto translated ai sounds bad

n
Автор

Ugh!: interjection All: pronoun these: adverb types: noun make: verb it: pronoun so: adverb hard: adverb to: particle read: verb

davidmurphy