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

Резултати

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

Пребарај: #timezone

当前筛选 #timezone清除筛选
djangoproject

@djangoproject · Post #128 · 31.08.2016 г., 15:33

https://pypi.python.org/pypi/pytz? #pytz brings the Olson tz database into Python. This library allows accurate and cross platform #timezone calculations using Python 2.4 or higher. It also solves the issue of ambiguous times at the end of daylight saving time, which you can read more about in the Python Library Reference (`datetime.tzinfo`).

Amazing Geography 🌍

@amazingeo · Post #302 · 27.09.2025 г., 12:31

🌍 Some countries adjust their time zones by just a single minute. Venezuela, for example, once set its clocks to UTC−4:30, then shifted to UTC−4:00 for efficiency, creating rare minute-level changes. ✨ #timezone⚡#clocks⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #490 · 02.12.2025 г., 20:31

🌍 China uses a single official time zone—Beijing Time—across its vast territory, even though natural time differs by up to four hours from east to west within the country. ✨ #timezone⚡#china⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #602 · 30.01.2026 г., 12:31

🌍 Samoa and American Samoa are just 160 kilometers apart but are 24 hours apart on the calendar due to the International Date Line, making them neighbors living in different days. ✨ #timezone⚡#Pacific⚡#islands⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #54 · 15.08.2025 г., 16:12

🌍 The Chatham Islands, east of New Zealand, use a unique time zone: Chatham Standard Time is 45 minutes ahead of New Zealand, making it one of the few zones offset by less than a full hour. ✨ #timezone⚡#islands⚡#Pacific⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍

Amazing Geography 🌍

@amazingeo · Post #642 · 19.02.2026 г., 20:31

🌍 Spain's Canary Islands, though just west of Africa, use the same time zone as mainland Spain. Their clocks are always one hour behind the rest of the country, bridging continents by time. ✨ #timezone⚡#islands⚡#clocks⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #260 · 18.09.2025 г., 16:12

🌍 Samoa’s 2011 time zone shift moved it west of the International Date Line, so travelers flying there from the U.S. now skip a day entirely, making for a calendar jump like nowhere else. ✨ #timezone⚡#dateline⚡#pacific⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

Amazing Geography 🌍

@amazingeo · Post #43 · 13.08.2025 г., 20:12

🌍 The South Pole uses Coordinated Universal Time (UTC) for convenience, even though all lines of longitude—and thus every time zone—meet at this single icy point on Earth. ✨ #timezone⚡#Antarctica⚡#poles⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍

Amazing Geography 🌍

@amazingeo · Post #417 · 27.10.2025 г., 12:31

🌍 Chile’s unique Easter Island uses UTC–6 time zone, two hours behind mainland Chile. This rare split lets sunrise and sunset times align better with local daylight on the remote Pacific island. ✨ #timezone⚡#Pacific⚡#island⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #379 · 16.10.2025 г., 15:31

🌍 Central Australia uses a rare time zone offset of UTC+9:30. This half-hour difference was chosen to better match daylight with daily activities across vast, sparsely populated regions. ✨ #timezone⚡#Australia⚡#daylight⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40370 · 20.12.2025 г., 11:04

China uses one official time zone: China Standard Time (CST), 8 hours ahead of UTC, called Beijing Time. In Xinjiang, many Uyghurs use Xinjiang Time, 2 hours behind CST. China does not change clocks for Daylight Saving Time. To see the current time check [here] @googlefactss⏰🇨🇳 #China#TimeZone#CST#Xinjiang#BeijingTime#funfact