TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #197 · 4 јан.

Подразумеваемые неймспейсы или неявные пакеты. Этот функционал добавлен в Python 3.3 Что он означает? Ранее, до 3.3 пакетами считались лишь директории, в которых есть файл __init__.py. Этот файл одновременно являлся свидетельством того, что директория это Python-пакет, и служил "телом" этого пакета. То есть местом, где можно написать код, как это делается внутри модуля. Этот код исполняется в момент импорта пакета, так что его принято называть "код инициализации пакета". Начиная с версии 3.3 Любая директория считается пакетом и Python будет пытаться использовать любую директорию для импорта. Конечно, не любую в файловой системе, а только те что находятся в sys.path. Это значит, что теперь __init__.py нужно делать только если: 🔸 вам требуется создать код инициализации пакета 🔸 нужна совместимость со старыми версиями Python На мой взгляд это немного упрощает разработку, делает её чище, но с другой стороны убивает некоторую однозначность происходящего. Например, я создал репозиторий со своей библиотекой и рядом положил код примеров или тестов. repo_name/ my_library/ __init__.py main.py examples/ exam1.py exam2.py В этом репозитории пакетом является только my_library, остальные директории это не пакеты, это просто дополнительный код в файлах. Директория examples не добавлена в sys.path, в ней нет рабочих модулей. Но если она лежит рядом с my_library, то Python вполне сможет импортнуть из неё модули, так как посчитает что examples это валидный пакет. Конечно, пример несколько надуманный. Никто не будет добавлять корень репозитория в sys.path. Но, я думаю, суть ясна. Иногда директория это просто директория а не пакет! #basic#pep

Hashtags

Резултати

Пронајдени 156 слични објави

Пребарај: #idiom

当前筛选 #idiom清除筛选
English From Zero to Hero

@Learn_English_from_Zero_to_Hero · Post #60511 · 18.11.2025 г., 16:22

#Idiom 💢Go off on a tangent Or 💢 Go off at a tangent 🔰If a person or piece of writing goes off on a tangent or goes off at a tangent, they start saying or thinking something that is not directly connected with what they were saying or thinking before 💠Note:- In geometry, a tangent is a straight line which touches a curve at one point 🕸 Ex:- Our teacher would occasionally go off on a tangent and start talking about something totally unrelated to the textbook. 💠Note:- You can use other verbs instead of go 🕸 Ex:- The book's theme wandersoff on a tangent now and then.

Hashtags

English From Zero to Hero

@Learn_English_from_Zero_to_Hero · Post #59847 · 03.07.2025 г., 21:40

#Idiom 🕸People in society🕸 ❄️A self-made man ♣️ A person who is rich and successful because they have worked hard, not because they were born into a rich family ❄️The chattering classes ♣️ Educated people who enjoy discussing social, political and cultural issues ❄️A second-class citizen ♣️ Someone is treated as if they are less important than others in society ❄️The grass roots ♣️ Ordinary people in a political or sporting organisation, not the leaders ❄️ The silent majority ♣️ A large number of people who do not express their opinions publicly ❄️ The (men in) grey suits ♣️ People in business or politics with a lot of influence or power, although they are not well known to the public ❄️Public enemy number one ♣️ Smth or someone that a lot of people dislike or disapprove of ❄️New kid on the block ♣️ Someone who is new in a place or organisation and has many things to learn about it (informal).

Hashtags

English From Zero to Hero

@Learn_English_from_Zero_to_Hero · Post #59742 · 15.05.2025 г., 05:36

#Idiom 💢Even exchange: a trade of equal value; when you return something and take something else that costs the same price ✨ Ex: If you return that jacket and get this sweater instead, it will be an even exchange. They're both $39.99.

Hashtags

123•••10•••1213
ПретходнаСтраница 1 од 13Следна