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

Резултати

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

Пребарај: #water

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

@developmentnewsindia · Post #44355 · 03.05.2026 г., 07:46

🇮🇳🚱🇵🇰 Baglihar Dam’s gates on the Chenab River in Ramban, Jammu & Kashmir, remain shut, with no visible water being released downstream towards Pakistan. #Water

Hashtags

Practical information/skills

@PracticalInformation · Post #1331 · 31.07.2022 г., 05:49

California announces plan to charge landowners for their own water It's not satire — it's Agenda 2030 perfect awareness of all resources and economic activity. California has announced to landowners that they now are going to be billed for the water they take out of their own wells, on their own land. Hundreds of dollars in fees are looming, with 25% penalties for those who don't pay on time: "Landowners whose property is within an unmanaged area and contains an operating ground water extraction well must report the volume of groundwater extracted from the well. The groundwater extraction volume must be reported as a monthly total. In addition to pumping volumes, reports must include the location of the well and the place and purpose of use of the groundwater. Groundwater extraction reports are not due to the state water board until February 1, 2023. However, if you are required to report, the report must include pumping volumes for each month between the date of receipt of this letter and September 30, 2022." #Water https://www.wnd.com/2022/07/california-announces-plan-charge-landowners-water/

Hashtags

Contamination of drinking #water can occur at the source, during transportation, or storage at home. Ensure your water is safe before use: ➡️BOIL water before drinking ➡️USE water from safe sources ➡️STORE water in properly covered containers ➡️ENSURE bottled water is properly sealed before buying Advisory: https://ncdc.gov.ng/news/513/stop-cholera%3A-public-health-advisory #STOPCholera

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40493 · 07.01.2026 г., 07:02

A water filter called "Life Straw" allows a person to drink directly from a dirty water source. Extremely portable and easy to use, it filters water through pores that are tiny enough to block parasites and other types of bacteria. [Read more..] @googlefactss#water#nowyouknow

beng!

@mdmbeng · Post #2201 · 12.10.2024 г., 11:00

#限免#Water Eject 📳手机震动排水 喇叭清灰App 【 Water Eject 】终身会员限免速收 📣 频道:@mdmbeng 投稿:@mdmbeng_Bot

Interesting Planet 🌍

@interesting_planet_facts · Post #506 · 05.08.2025 г., 20:22

🌎 In Mexico's Yucatán Peninsula, the cenote Ik Kil is a natural sinkhole filled with crystal-clear water, formed by collapsed limestone over thousands of years. Once sacred to the Maya, these cenotes provided fresh water and served as entrances to the underworld in ancient beliefs. ✨ #geology⚡#history⚡#water 👉subscribe Interesting Planet

123•••89
ПретходнаСтраница 1 од 9Следна