- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
This Bug Is In Your Code: Why does __var silently become _Class__var in subclasses?
Python Short: Why does __var silently become _Class__var in subclasses?
In this Python short:
- The bug shown
- Why Python does this
- The correct fix
Explanation: The bug is that __secret in Child creates a distinct _Child__secret attribute, not overriding Base's _Base__secret. Python name-mangles double-underscore vars to prevent accidental overrides across inheritance chains, resolving to _ClassName__var internally. To override, explicitly use the mangled n
Master name mangling before your next FAANG interview
Subscribe to OopsPython for daily Python fixes.
New Python mistake explained every day!
#python #short #why #does #__var #silently #become #_class__var #in #subclasses #this #the #bug #shown #correct #fix #explanation #is #that #__secret #child #creates #a #distinct #_child__secret #attribute #not #overriding #base #s #_base__secret #name #mangles #double #underscore #vars #to #prevent #accidental #overrides #across #inheritance #chains #resolving #_classname__var #internally #override #explicitly #use #mangled #n #master #mangling #before #your #next #faang #interview #subscribe #oopspython #for #daily #fixes #new #mistake #explained #every #day #pythonshorts #coding #programming #pythontips #learnpython #pythonmistakes #developer
Видео This Bug Is In Your Code: Why does __var silently become _Class__var in subclasses? канала OopsPython
In this Python short:
- The bug shown
- Why Python does this
- The correct fix
Explanation: The bug is that __secret in Child creates a distinct _Child__secret attribute, not overriding Base's _Base__secret. Python name-mangles double-underscore vars to prevent accidental overrides across inheritance chains, resolving to _ClassName__var internally. To override, explicitly use the mangled n
Master name mangling before your next FAANG interview
Subscribe to OopsPython for daily Python fixes.
New Python mistake explained every day!
#python #short #why #does #__var #silently #become #_class__var #in #subclasses #this #the #bug #shown #correct #fix #explanation #is #that #__secret #child #creates #a #distinct #_child__secret #attribute #not #overriding #base #s #_base__secret #name #mangles #double #underscore #vars #to #prevent #accidental #overrides #across #inheritance #chains #resolving #_classname__var #internally #override #explicitly #use #mangled #n #master #mangling #before #your #next #faang #interview #subscribe #oopspython #for #daily #fixes #new #mistake #explained #every #day #pythonshorts #coding #programming #pythontips #learnpython #pythonmistakes #developer
Видео This Bug Is In Your Code: Why does __var silently become _Class__var in subclasses? канала OopsPython
coding interview python coding shorts coding tips developer tips faang python learn python oopspython programming python python advanced python bug python debugging python double underscore name python expert tips python explained python gotchas python internals python interview python interview prep python interview questions python mistakes python performance python shorts python tips python tutorial python under the hood software engineering
Комментарии отсутствуют
Информация о видео
27 апреля 2026 г. 16:52:11
00:00:33
Другие видео канала










![Tricky Python Behavior: Why does list[1:3] = [] delete elements in-place?](https://i.ytimg.com/vi/8PpwSSQIl4g/default.jpg)










