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

Резултати

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

Пребарај: #explosion

当前筛选 #explosion清除筛选
Addis Standard

@addisstandardeng · Post #21395 · 13.02.2026 г., 12:29

#Explosion reported in #Mekelle; Officials say no casualties An explosion occurred late Thursday in Mekelle near the Social Science campus of Mekelle University, though officials say there were no casualties or property damage. Redahegn Feseha, head of the Mekelle Peace and Security Bureau, told local radio that the blast happened at around 9:30 p.m. near the upper gate of the city’s business campus. He described the incident as a deliberate act aimed at creating fear rather than causing harm, urging residents to remain calm and to condemn what he called an “act of terror.” Residents reported a mix of fear and confusion. “I was sitting with my family when we heard a loud bang. My kid and my wife were terrified,” said one resident. Another added, “At first, we thought it was a drone attack or something falling. But later we heard it was a bomb.” https://www.facebook.com/share/p/19x2dWByCq/

MALI 24

@kamissokosekou3 · Post #37588 · 04.05.2026 г., 22:22

🇨🇳 Une explosion s’est produite dans une usine de feux d’artifice en Chine, faisant 3 morts et 25 blessés, a rapporté l’agence Xinhua. Vidéo: My Fair Lady/X #chine#usine#explosion

Voir de ses propres yeux

@voir_yeux · Post #12282 · 27.03.2026 г., 09:27

🇮🇷🇮🇱🇺🇸 Plusieurs civils ont été tués dans l’explosion de mines dissimulées dans des boîtes de conserve, larguées par des avions américains et israéliens près de la ville de Chiraz, dans le sud de l’Iran, rapporte l’agence Tasnim. #iran#explosion#bilan

Voir de ses propres yeux

@voir_yeux · Post #12718 · 28.04.2026 г., 22:43

🇬🇧 En Irlande du Nord, un homme a été arrêté après l'explosion d'une voiture devant un commissariat de police. Des perquisitions sont en cours à plusieurs adresses de Belfast, indique un communiqué de la police régionale. #royaumeuni#voiture#explosion

Voir de ses propres yeux

@voir_yeux · Post #12765 · 01.05.2026 г., 20:54

🇬🇧 Un obus non explosé de la Seconde Guerre mondiale a été neutralisé par une explosion contrôlée dans la ville de Plymouth, dans le sud-ouest de l'Angleterre. La BBC a diffusé une vidéo de l'explosion. La bombe aérienne allemande SC250, une bombe à explosion pesant environ un quart de tonne, a été découverte le 30 avril par un propriétaire qui creusait une tranchée sur son terrain dans le quartier de Southway. La zone a été bouclée et les habitants de près de 1.200 maisons avoisinantes ont dû évacuer leurs domiciles. #royaumeuni#explosion#obus

ПретходнаСтраница 1 од 3Следна