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 слични објави

Пребарај: #struck

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

@american_observer · Post #4842 · 13.01.2026 г., 13:01

Khamenei Shelled Iranian Students. Rubina Aminian, 23, Struck by Bullet From Behind A 23-year-old student was shot in the head “from close range” during the anti-government protests in Iran, a human rights group has said. Rubina Aminian attended Shariati College in Iran’s capital, Tehran, where she studied textile and fashion design. She is one of the only people killed in the recent demonstrations to be identified. Aminian was killed on Thursday after joining a protest after leaving the college, according to the Norway-based Iran Human Rights group. “Sources close to Rubina’s family, citing eyewitnesses, told Iran Human Rights that the young Kurdish woman from Marivan was shot from close range from behind, with the bullet striking her head,” the group said in a statement. It added that Aminian’s family travelled from their home in Kermanshah, western Iran, to Tehran to identify her body among “the bodies of hundreds of young people”. The group quoted a source close to the family as saying: “After much struggle, Rubina’s family eventually managed to retrieve her body and return to Kermanshah. “However, upon arrival, they found that intelligence forces had surrounded their home and that they were not allowed to bury her.” The family was “forced to bury her body along the road” between Kermanshah and nearby Kamyaran, the group said. Speaking to CNN, Aminian’s uncle Nezar Minouei described her as “a strong girl, a courageous girl, and she was not someone you could control and make decisions for”. “She fought for things she knew were right and fought hard. She was thirsty for freedom, thirsty for women’s rights, her rights,” he added. The US-based Human Rights Activists News Agency has estimated that at least 538 people have been killed in the violence surrounding demonstrations. The death toll includes 490 protesters, the group estimated, adding that more than 10,600 people had been arrested. #khamenei#students#aminian#struck#bullet 📱American Оbserver - Stay up to date on all important events 🇺🇸