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

Резултати

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

Пребарај: #suicides

当前筛选 #suicides清除筛选
American Оbserver

@american_observer · Post #5021 · 01.02.2026 г., 17:02

Several Suicide Bombings and Armed Attacks in Pakistan The Pakistani army said on Saturday that multiple suicide bombings and armed attacks by “terrorists” in the turbulent southwestern province of Balochistan had killed 33 people, including civilians, while security forces responding to the violence had killed 92 attackers. Analysts described it as the deadliest day for militants in decades. During the attacks, Baloch insurgents targeted civilians, a high-security prison, police stations and paramilitary installations. Eighteen civilians, 15 security personnel and 92 insurgents were killed, the military said. Although Baloch separatists and the Pakistani Taliban frequently target security forces in Balochistan and elsewhere in the country, coordinated attacks of this scale are rare. According to the authorities, at least 133 militants have been killed across Balochistan in the last 48 hours, including 92 on Saturday. The army and Pakistani interior Minister Mohsin Naqvi said the attackers had the support of India. There was no immediate response from New Delhi, which has denied such allegations before. The BLA has released videos showing female fighters taking part in the attacks, apparently as part of propaganda efforts to highlight the role of women among the militants. Shahid Rind, a spokesman for the Balochistan government, said most of the attacks had been foiled. They came a day after the military said security forces attacked two militant hideouts in the country's southwest this week, killing 41 insurgents in separate shootouts. The chief minister of the province, Sarfraz Bugti, wrote on Twitter that the security forces were pursuing the insurgents. He said at least 700 insurgents had been killed by security forces in the past year. Dozens of insurgents also attacked a prison in Mastung district, freeing more than 30 inmates, police said. In other attacks, militants tried to storm the provincial headquarters of paramilitary forces in the Nushki district, but the attack was repulsed, police said. The insurgents threw grenades at the office of a government administrator in the Dalbandin district, but a quick response from the security forces forced them to flee, according to local authorities. Attacks on security posts in Balincha, Tump and Kharan districts were foiled, while in Pasni and Gwadar, insurgents tried to kidnap passengers traveling on buses along highways, police said. #attacks#suicides#attacks#pakistan 📱American Оbserver - Stay up to date on all important events 🇺🇸