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

Резултати

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

Пребарај: #bikes

当前筛选 #bikes清除筛选
Car News

@car_news · Post #1891 · 16.03.2026 г., 13:28

🇯🇵 Yamaha releases the world’s first production scooter with an airbag 🏍 The new Tricity 300 (2026) features a collision detection system that deploys an airbag from under the handlebar during an accident. 🤞 Tests show that using this system reduces life-threatening risk by more than 30 times. 💰 Sales are expected to start next quarter. The official price hasn’t been announced yet, but the current Tricity 300 version costs around $10,000. #bikes@Car_News

Hashtags

Car News

@car_news · Post #1650 · 08.11.2025 г., 14:45

🏍Brabus unveils motorcycle priced at €42,000 📰 German tuning house Brabus has presented the exclusive 1400 R Signature Edition bike, based on the KTM 1390 Super Duke R EVO. 🔎 The motorcycle features carbon bodywork, 17-inch Monoblock II EVO Platinum Edition wheels, leather seats with Dinamica microfiber, and special dashboard graphics. 🐎 The 1.35-liter V2 engine retains its 190 hp and 145 Nm output and is complemented by a Brabus exhaust system. The bike is equipped with WP-APEX semi-active suspension and Brembo brakes. #bikes#Brabus@Car_News

Car News

@car_news · Post #1591 · 17.10.2025 г., 12:40

📰Yamaha goes full cyberpunk 🏍 This is the MOTOROiD 2, a motorcycle from the future. 🔎 It features a self-balancing system that keeps the bike upright and prevents it from tipping over. The bike can recognize its owner’s face and respond to gestures. Instead of traditional handlebars, it has integrated grips built into the body and supports autonomous control. #Yamaha#bikes@Car_News

Bali News

@balinews · Post #346 · 11.03.2025 г., 12:00

🛵Bali governor wants to ban tourists from driving bikes...again 😠 Bali Governor Wayan Koster has decided to revisit the topic of tourists driving motorcycles. He complained that foreigners are recklessly riding motorcycles without clothes and without helmets. 📰 The governor plans to introduce a regional PERDA regulation banning tourists from driving motorcycles. The measure is proposed in response to frequent traffic violations by commuters and is aimed at improving safety and order on the roads. 🤔Such initiatives have arisen before, but did not find support from the authorities and were not implemented. It is still unknown whether this decree will pass now, as the Minister of Tourism in Indonesia has changed since last time. @BaliNews #transport#bikes#rules#tourism