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

Резултати

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

Пребарај: #mimicry

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

@interesting_planet_facts · Post #614 · 23.08.2025 г., 13:22

🌎 The lyrebird’s call isn’t its only quirky skill—it can mimic the sound of chainsaws, camera shutters, and even car alarms, thanks to the most complex vocal organs in the bird world. These copycat birds help signal their territory and attract mates, showing off nature’s ultimate vocal impressionist. ✨ #birds⚡#mimicry⚡#nature 👉subscribe Interesting Planet ​

Interesting Planet 🌍

@interesting_planet_facts · Post #446 · 28.07.2025 г., 13:22

🌎 The blue poison fang blenny avoids predators by mimicking deadly fish and carrying real toxins in its bite—one of the few venomous fish that inject opioid-like chemicals, numbing attackers instantly. ✨ #venom⚡#mimicry⚡#ocean 👉subscribe Interesting Planet

Interesting Planet 🌍

@interesting_planet_facts · Post #1123 · 12.12.2025 г., 18:11

🌎 The male Australian superb lyrebird can mimic over 20 different bird species and even human sounds. Its tail feathers form a fan shape used in courtship displays. Lyrebirds have the most complex vocal repertoire of any songbird, with some males learning new sounds throughout their lives. ✨ #lyrebird⚡#adaptation⚡#mimicry 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #459 · 29.07.2025 г., 17:22

🌎 The mimic poison frog of Central America’s rainforests sports dazzling colors that copy other toxic frogs, deterring predators through clever visual deception rather than its own strong toxins. ✨ #rainforest⚡#mimicry⚡#frogs 👉subscribe Interesting Planet

Interesting Planet 🌍

@interesting_planet_facts · Post #573 · 16.08.2025 г., 20:22

🌎 The bolas spider swings a sticky silk “lure” scented like female moths to attract unsuspecting mates—then snags them midair in a single swoop! ✨ #spider⚡#mimicry⚡#hunting 👉subscribe Interesting Planet