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

Резултати

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

Пребарај: #building

当前筛选 #building清除筛选

#from#building A series of immersive geodesic dome glamping sites, each featuring a panoramic window composed of precisely 16 equilateral triangles on the front facade. Nestled in a lush rainforest, the domes measure 6 meters in diameter and 3.5 meters in height. The transparent panoramic window provides an uninterrupted view of towering trees, vibrant flora, and the gentle trickle of a nearby waterfall. The photo captures the integration of the dome structures within the dense foliage, with the panoramic windows acting as portals into the enchanting forest. Sunlight filters through the canopy, creating a mesmerizing interplay of light and shadow within the domes. The overall ambiance is one of tranquility and harmony with nature, enticing visitors to embark on a serene glamping experience amidst the rainforest's embrace. Photography, mirrorless camera with a prime lens to capture the intricate details of the rainforest, --ar 16:9 ✅ Revive Homes _Discord @ai_artz

#from#building A city of circular houses and community centers made out of grafted willow trees, recycled materials, and biomaterials; humans and animals coexisting amongst lush greenery and abounding nature without the presence of industrial materials ✅ nlynch00 _Discord @ai_artz

#from#building Floating House Visualization Amphibious design, flood-resilient construction, modular living spaces, energy-efficient technologies, solar panels, bold color accents, sustainable materials, adaptable to rising water levels, dimensions: 12m (L) x 8m (W) x 6m (H) --v 5 ✅ Ahmet Ç _Discord @ai_artz🌿

#from#building An interior view of a Burger QSR featuring blue, orange, and white accents throughout the space. The seating area is decorated with a mix of comfortable chairs and booths, while the walls are adorned with abstract art and geometric patterns. The lighting fixtures create a warm and inviting atmosphere, complementing the vibrant color palette and fostering a sense of community. ✅ rajivkk _Discord @ai_artz

ПретходнаСтраница 1 од 3Следна