TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #60 · 31 мар.

Вторая по частоте future-функция, которую я использовал, это абсолютный импорт from __future__ import absolute_import Что она делает? Изменения, которые вносит эта инъекция описаны в PEP328 Покажу простой пример. Допустим, есть такой пакет: /my_package /__init__.py /main.py /string.py Смотрим код в my_package/main.py # main.py import string Простой пример готов) Вопрос в том, какой модуль импортируется в данном случае? Есть два варианта: 1. модуль в моём пакете my_package.string 2. стандартный модуль string И вот тут вступает в дело приоритет импортов. В Python2 порядок следующий: помимо иных источников, раньше ищется модуль внутри текущего пакета, а потом в стандартных библиотеках. Таким образом мы импортнём my_package.string. Но в Python3 это поведение изменилось. Если мы указываем просто имя пакета, то ищется именно такой модуль, игнорируя имена в текущем пакете. Если мы хотим импортнуть именно подмодуль из нашего пакета то, мы должны теперь явно это указывать. from my_package import string или относительный импорт, но с указанием пути относительно текущего модуля main from . import string Еще одной неоднозначностью меньше 😎 Подробней про импорты здесь: https://docs.python.org/3/tutorial/modules.html #2to3#pep#basic

Резултати

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

Пребарај: #humanimpact

当前筛选 #humanimpact清除筛选
Interesting Planet 🌍

@interesting_planet_facts · Post #829 · 28.09.2025 г., 20:11

🌎 Southern China’s Stone Forest, or Shilin, is a dramatic landscape of towering limestone pillars shaped by both natural erosion and centuries of quarrying. Human mining over the last thousand years has altered parts of this ancient karst region, creating new rock formations and open spaces alongside original spires. ✨ #geology⚡#humanimpact⚡#landscapes 👉subscribe Interesting Planet 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #16 · 10.08.2025 г., 03:12

🌍 Cities often create "urban heat islands," where temperatures are higher than surrounding areas due to concrete, asphalt, and less greenery. This effect can raise cities’ temperatures by several degrees. ✨ #urbanization⚡#temperature⚡#humanimpact⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍

Interesting Planet 🌍

@interesting_planet_facts · Post #799 · 22.09.2025 г., 20:11

🌎 One of Earth's largest artificial lakes, Lake Volta in Ghana, was created in the 1960s by damming the Volta River. Spanning about 8,500 square kilometers, it supports fisheries and transportation but submerged forests and displaced over 78,000 people during its construction. ✨ #humanimpact⚡#reservoirs⚡#Africa 👉subscribe Interesting Planet 👉more channels Channel list ​

Interesting Planet 🌍

@interesting_planet_facts · Post #930 · 18.10.2025 г., 18:11

🌎 The Florida Everglades, once a vast slow-moving river system, has been dramatically altered by canals, levees, and drainage for agriculture and cities. Over 50% of the original wetlands have been lost since the early 20th century, reducing habitat for species like the Florida panther and snail kite. ✨ #Everglades⚡#wetlands⚡#humanimpact 👉subscribe Interesting Planet 👉more Channels ​