Logo
TGCATALOG
Catalog Collections Blog
Code on a Napkin - Python coding

Code on a Napkin - Python coding

Channel about programming in Python and other languages. Simple explanations and codes.

No ratings
317
26.10.2026
317
26.10.2026
No ratings
317
26.10.2026
Safe redirect via bot
О канале

Channel about programming in Python and other languages. Simple explanations and codes.

Подписчиков 2,347
Тематика Technology
Язык English
Ссылка t.me/napkincode

We also recommend

Kekaton AI | Voiceover and voice clone
Kekaton AI | Voiceover and voice clone
Bot

AI bot for text-to-speech and voice cloning in Telegram. Create audio using neural network quickly and easily.

Description

Resource for those interested in programming. Focus on Python, but covers other topics as well. Simple examples and breakdowns.

Latest posts

Code on a Napkin - Python coding
Code on a Napkin - Python coding
🔒Открыть пост
и посмотреть медиа
Знаете ли вы, что Python иногда подменяет атрибуты класса? Когда Python читает атрибут через объект, он не всегда возвращает то, что лежит в классе. Если у найденного объекта есть метод __get__, Python вызывает его и отдает результат вместо самого атрибута. Функция в классе – это такой объект, поэтому User.greet и u.greet возвращают разные вещи. Первое – функцию, второе – bound method с уже зашитым self. class User: def greet(self): return "hello" u = User() print(type(User.greet)) # print(type(u.greet)) # print(User.greet is u.greet) # False User.greet – просто функция. u.greet – bound method, отдельный объект, который Python создал в момент обращения. В нем уже зашит u как первый аргумент – поэтому self появляется автоматически. Дескриптор – это любой объект с методом __get__. Python вызывает его когда находит такой объект в __dict__ класса: class Readonly: def __get__(self, obj, objtype=None): if obj is None: return self # доступ через класс return 42 # доступ через инстанс class User: score = Readonly() u = User() print(User.score) # print(u.score) # 42 score в User.__dict__ – это объект Readonly. Python видит у него __get__ и вызывает его вместо того чтобы вернуть напрямую. Именно так работают property, classmethod, staticmethod – все они дескрипторы. class User: @classmethod def create(cls): return cls() print(type(User.__dict__["create"])) # print(type(User.create)) # В __dict__ лежит объект classmethod. При обращении через класс срабатывает его __get__ – и возвращается уже bound method с привязанным классом. Функции становятся методами не в момент определения класса, а в момент обращения через инстанс; но механизм один – __get__. В следующий раз – посмотрим на @property. Код на салфетке x Кусочки кода
Code on a Napkin - Python coding
FAQ

Open Code on a Napkin - Python coding in Telegram and press the Start button. No separate registration is required.

Yes. The service is designed to be straightforward: open the resource, follow the on-screen instructions and start using it.

No. You can use Code on a Napkin - Python coding directly in Telegram unless the resource description says otherwise.

Access depends on the resource. Check the current information in Telegram after opening Code on a Napkin - Python coding.

The exact features depend on the resource. Open Code on a Napkin - Python coding to see its current functions, content and access conditions.
Subscriber dynamics
+-0.4% last 30 days
Current
2,347
Month ago
2,356
Average growth
+0 / day
Updated
16 hours ago

Reviews for channel Code on a Napkin - Python coding

Log in to leave a review

Only registered users can share their opinion.

No reviews yet

Be the first to share your impression of this resource!

Similar resources

Loading
Switch to Light Theme
Home Catalog Collections Blog Login