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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #205 · 22 јан.

Как работает функция reload()? Эта функция нужна для того, чтобы перезагрузить изменившийся код из py-файла без рестарта интерпретатора. Дело в том, что любой импортированный модуль при повторном импорте не будет перечитывать файл. Функция импорта вернёт уже загруженный в память объект модуля. Чтобы обновить код, нужно либо перезапустить всю программу, либо использовать функцию reload() from importlib import reload reload(my_module) 🔸 Функция reload() принимает в качестве аргумента только объект модуля или пакета. Она не может перезагрузить класс или функцию. Только весь файл целиком! 🔸 Перезагрузка пакета перезагрузит только его файл __init__.py, если он есть. Но не вложенные модули. 🔸Она не может перезагрузить ранее не импортированный модуль. 🔸При вызове функция reload() перечитывает и перекомпилирует код в файле, создавая новые объекты. После создания новых объектов перезаписывается ранее созданный неймспейс этого модуля. Это значит, что если где-то этот модуль импортирован через import и обращение к атрибутам происходит через неймспейс (имя) модуля, то такие атрибуты обновятся. Если какие-либо объекты из этого модуля импортированы через from то они будут ссылаться на старые объекты. Напишем простой модуль # mymodule.py x = 1 Теперь импортируем модуль и отдельно переменную х из модуля >>> import mymodule >>> from mymodule import x >>> print(mymodule.x) 1 >>> print(x) 1 Не перезапуская интерпретатор вносим изменения в модуль # mymodule.py x = 2 Делаем перезагрузку модуля и проверяем х ещё раз >>> reload(mymodule) >>> print(mymodule.x) 2 >>> print(x) 1 То же самое будет если присвоить любой объект переменной (даже словарь или список) Повторный импорт обновляет значение >>> from mymodule import x >>> print(x) 2 🔸Созданные инстансы классов не обновятся после перезагрузки модуля. Их придётся пересоздать. #tricks#basic

Резултати

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

Пребарај: #solar

当前筛选 #solar清除筛选
Indian Development News 🇮🇳

@developmentnewsindia · Post #44371 · 03.05.2026 г., 13:50

Tata Power Renewable Energy Limited (TPREL) received board approval to invest ₹6,500 crore to establish a 10 GW photovoltaic ingot and wafer manufacturing facility. The project will be developed in two phases of 5 GW each, likely at a greenfield site in Nellore, Andhra Pradesh, with an estimated payback period of five years. This strategic expansion into upstream manufacturing allows Tata Power to achieve backward integration, significantly reducing reliance on Chinese imports while aligning with India’s ALMM framework to strengthen the domestic solar supply chain. Source #MakeInindia#solar

Indian Development News 🇮🇳

@developmentnewsindia · Post #44370 · 03.05.2026 г., 13:40

Andhra Pradesh Chief Minister N Chandrababu Naidu will lay the foundation stone for ReNew Energy Global plc's Rs 5,400 crore solar manufacturing facility in Anakapalli district. This 6 GW solar ingot and wafer unit marks a significant step in India's push for domestic clean energy manufacturing and energy security, aligning with the state's Integrated Clean Energy Policy 2024 Source #MakeInindia#solar

Interesting Planet 🌍

@interesting_planet_facts · Post #864 · 05.10.2025 г., 20:11

🌎 Pluto, once called the ninth planet, orbits in the distant Kuiper Belt and takes about 248 Earth years to complete one orbit around the Sun. ✨ #planets⚡#astronomy⚡#solar-system 👉subscribe Interesting Planet 👉more Channels ​

Interesting Planet 🌍

@interesting_planet_facts · Post #664 · 31.08.2025 г., 18:22

🌎 Jupiter’s Great Red Spot is a giant storm larger than Earth and has been raging for at least 350 years, swirling powerful winds nonstop across the planet’s atmosphere. ✨ #planets⚡#astronomy⚡#solar 👉subscribe Interesting Planet ​

Amazing Geography 🌍

@amazingeo · Post #205 · 09.09.2025 г., 13:12

🌍 On rare occasions, the aurora can be seen far from the poles, reaching as far south as Texas or southern Europe during strong solar storms. Their shifting shapes can move faster than a cheetah runs. ✨ #aurora⚡#atmosphere⚡#solar⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

Amazing Geography 🌍

@amazingeo · Post #222 · 12.09.2025 г., 09:12

🌍 Earth travels around the Sun at nearly 30 kilometers per second. This speedy journey means our planet covers more than 940 million kilometers every year as it orbits through space. ✨ #Earth⚡#orbit⚡#solar⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

Love Nature

@LovelyNature · Post #1501 · 09.05.2021 г., 15:53

Japan is home to 73 of world's 100 largest floating #solar plants they prevent water evaporating, and help secure reservoirs in water-stressed countries. - #Japan#Naturehttps://twitter.com/i/status/1391177362927198211@LovelyNature

Online Education

@OnlineEducation10 · Post #327 · 09.05.2021 г., 15:53

Japan is home to 73 of world's 100 largest floating #solar plants they prevent water evaporating, and help secure reservoirs in water-stressed countries. - #Japan#Naturehttps://twitter.com/i/status/1391177362927198211@OnlineEducation10

Universe Mysteries 🪐

@cosmomyst · Post #721 · 24.03.2026 г., 22:21

🪐 NASA and ESA are collaborating on future missions to develop solar sail technology—a method that harnesses sunlight for propulsion—to power lightweight spacecraft toward nearby stars like Alpha Centauri. Unlike rockets, solar sails use the gentle push of photons (tiny particles of light) from the Sun to gradually accelerate, making it possible for small probes to reach interstellar space without carrying any fuel onboard. ✨ #spaceships⚡#interstellar⚡#solar⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

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