module level __getattr__ (intermediate) anthony explains

  Рет қаралды 5,986

anthonywritescode

anthonywritescode

Күн бұрын

Пікірлер: 9
@Phaust94
@Phaust94 Жыл бұрын
Man, I've been coding Python for 6 years by now - and never heard of __dir__ for tab completion. This channel is pure gold.
@Quarky_
@Quarky_ Жыл бұрын
Thanks for the __dir__ comment, I got stuck on this couple weeks ago when I was implementing __getattr__ to expose attributes of an underlying "private" object.
@kai3341
@kai3341 Жыл бұрын
Thank you for video. Also great thank you for your english -- it's easy to recognize it and then understand
@williamli55
@williamli55 8 ай бұрын
Hello Anthony. I've been watching your videos for a while now, and I think they're great. I was wondering if you might be willing to do a video which goes further into depth on __getattr__, __setattr__, and __getattribute__. I'd love to have a better understanding of how to properly use these methods. I feel like I often don't implement them properly.
@dorb1337
@dorb1337 Жыл бұрын
When I created a def __dir__(self): return list(globals()) under a class C (like you created, just with the __dir__ function inside the class instead of outside to it) and i called c.__dir__() I got a lot of random gibbrish output, do you have any idea what it might point to ? ( My idea was that when globals() is called under a class, it just returns some random memory values that points to stuff, but when printed to the screen has no meaning) . here's my output example - ['__name__', '__doc__', '__package__', '__loader__', '__spec__', '__builtin__', '__builtins__', '_ih', '_oh', '_dh', 'In', 'Out', 'get_ipython', 'exit', 'quit', '_', '__', '___', '_i', '_ii', '_iii', '_i1', 'C', '_i2', '_i3', 'c', '_i4', '_4', '_i5', '_i6', '_6', '_i7', 'B', '_i8', 'b', '_i9', '_9', '_i10', '_10', '_i11', 'A', '_i12', '_i13', 'a', '_i14', '_i15', '_15', '_i16', '__dir__', '_i17', '_i18', '_18', '_i19', '_i20', '_i21', '_21', '_i22', '_22', '_i23']
@anthonywritescode
@anthonywritescode Жыл бұрын
that's ipython garbage
@b_0rk
@b_0rk Жыл бұрын
hi does this also work on python 2.4
@cerealport2726
@cerealport2726 Жыл бұрын
You could just try it and see...but as was explained, it seems it was added in 3.7
@xan1716
@xan1716 Жыл бұрын
what year is this 😅
why are some things shell builtins? (intermediate) anthony explains #510
3:32
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 4,6 МЛН
風船をキャッチしろ!🎈 Balloon catch Challenges
00:57
はじめしゃちょー(hajime)
Рет қаралды 97 МЛН
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 127 МЛН
The Singing Challenge #joker #Harriet Quinn
00:35
佐助与鸣人
Рет қаралды 47 МЛН
how do virtualenvs actually work (advanced) anthony explains #522
16:55
anthonywritescode
Рет қаралды 7 М.
python: what is weakref? (intermediate - advanced) anthony explains #366
10:40
Avoid These BAD Practices in Python OOP
24:42
ArjanCodes
Рет қаралды 74 М.
don't lru_cache methods! (intermediate) anthony explains #382
10:37
anthonywritescode
Рет қаралды 14 М.
typing the untype-able with mypy plugins (advanced) anthony explains #574
25:06
python descriptors! (advanced) anthony explains #519
19:04
anthonywritescode
Рет қаралды 17 М.
Python Plugin System: Load Modules Dynamically With "importlib"
14:54
adding test == others fail??? (intermediate) anthony explains #572
10:40
anthonywritescode
Рет қаралды 4,3 М.
ТЫ В ДЕТСТВЕ КОГДА ВЫПАЛ ЗУБ😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 4,6 МЛН