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

Резултати

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

Пребарај: #sgdengueupdate

当前筛选 #sgdengueupdate清除筛选
NEA Singapore

@NEASingapore · Post #701 · 10.11.2023 г., 03:48

#SGDengueUpdate 153 new dengue cases and 53 active dengue clusters were reported in the week ending 4 Nov 2023. If you are living in a dengue cluster area, or have been diagnosed with or are suspected to be infected with dengue,carry out ‘S-A-W’ and ‘B-L-O-C-K’ actions immediately: https://go.gov.sg/mozzieproof ⚠️ Continued urgent action from all is critical to prevent a surge in dengue cases at year-end.

NEA Singapore

@NEASingapore · Post #697 · 02.11.2023 г., 09:37

#SGDengueUpdate 191 new dengue cases and 50 active dengue clusters were reported in the week ending 28 Oct 2023. If you are living in a dengue cluster area, or have been diagnosed with or are suspected to be infected with dengue,carry out ‘S-A-W’ and ‘B-L-O-C-K’ actions immediately: https://go.gov.sg/mozzieproof ⚠️ Continued urgent action from all is critical to prevent a surge in dengue cases at year-end.

NEA Singapore

@NEASingapore · Post #682 · 20.10.2023 г., 00:39

#SGDengueUpdate 215 new dengue cases and 66 active dengue clusters were reported in the week ending 14 Oct 2023. If you are living in a dengue cluster area, or have been diagnosed with or are suspected to be infected with dengue,carry out ‘S-A-W’ and ‘B-L-O-C-K’ actions immediately: https://go.gov.sg/mozzieproof The weekly number of dengue cases has increased steadily, and is expected to rise beyond the traditional peak dengue season, with many dengue clusters across the island. Urgent action from all is critical to prevent a surge in dengue cases at year-end.

NEA Singapore

@NEASingapore · Post #667 · 12.10.2023 г., 09:28

#SGDengueUpdate 267 new dengue cases and 90 active dengue clusters were reported in the week ending 7 Oct 2023. If you are living in a dengue cluster area, or have been diagnosed with or suspected to be infected with dengue,carry out ‘S-A-W’ and ‘B-L-O-C-K’ actions immediately: https://go.gov.sg/mozzieproof ⚠️ The number of dengue cases is expected to rise beyond the traditional peak dengue season, as fast rate of dengue transmission is seen in dengue clusters across the island. Urgent action from all is critical to prevent a surge in dengue cases at year-end.

NEA Singapore

@NEASingapore · Post #655 · 05.10.2023 г., 10:15

#SGDengueUpdate 343 new dengue cases and 76 active dengue clusters were reported in the week ending 30 Sep 2023. No new Zika cases were reported last week. If you are living in a dengue cluster area, or have been diagnosed with or suspected to be infected with dengue,carry out ‘S-A-W’ and ‘B-L-O-C-K’ actions immediately: https://go.gov.sg/mozzieproof

NEA Singapore

@NEASingapore · Post #649 · 28.09.2023 г., 09:14

#SGDengueUpdate 303 new dengue cases and 64 active dengue clusters were reported in the week ending 23 Sep 2023. No new Zika cases were reported last week. If you are living in a dengue cluster area, or have been diagnosed with or suspected to be infected with dengue,carry out ‘S-A-W’ and ‘B-L-O-C-K’ actions immediately: https://go.gov.sg/mozzieproof

NEA Singapore

@NEASingapore · Post #647 · 21.09.2023 г., 09:53

#SGDengueUpdate 330 new dengue cases and 56 active dengue clusters were reported in the week ending 16 Sep 2023. Two new Zika cases were also reported last week. The number of dengue cases at Toa Payoh remains high. If you are living in a dengue cluster area, or have been diagnosed with or suspected to be infected with dengue,carry out ‘S-A-W’ and ‘B-L-O-C-K’ actions immediately: https://go.gov.sg/mozzieproof

NEA Singapore

@NEASingapore · Post #643 · 14.09.2023 г., 09:10

#SGDengueUpdate 261 new dengue cases and 53 active dengue clusters were reported in the week ending 9 Sep 2023. There are two fast-growing dengue clusters at Science Park Drive (47 cases) and Lentor Loop (33 cases). The number of dengue cases at Toa Payoh remains high. If you are living in a dengue cluster area, or have been diagnosed with or suspected to be infected with dengue,carry out ‘S-A-W’ and ‘B-L-O-C-K’ actions immediately: https://go.gov.sg/mozzieproof

NEA Singapore

@NEASingapore · Post #640 · 07.09.2023 г., 10:06

#SGDengueUpdate 213 new dengue cases and 42 active dengue clusters were reported in the week ending 2 Sep 2023. There are two fast-growing dengue clusters at Science Park Drive (26 cases) and Lentor Loop (22 cases). The number of dengue cases at Toa Payoh remains high. Particularly if you are living in a dengue cluster area, or have been diagnosed with or suspected to be infected with dengue,carry out ‘S-A-W’ and ‘B-L-O-C-K’ actions immediately: https://go.gov.sg/mozzieproof

NEA Singapore

@NEASingapore · Post #276 · 26.10.2021 г., 10:16

#SGDengueUpdate Over 4,500 dengue cases have been reported this year, and there are currently 12 active dengue clusters. Although recent weekly dengue cases have been lower than during the same period in 2020, we should all continue to stay vigilant, to prevent a year-end rise in dengue cases amid higher circulation of less common Dengue virus serotype 3 (DENV-3)! Learn how you can prevent Aedes mosquitoes from breeding in your home: www.nea.gov.sg/dengue-zika/prevent-aedes-mosquito-breedin

NEA Singapore

@NEASingapore · Post #155 · 26.01.2021 г., 10:35

#SGDengueUpdate The number of weekly dengue cases has come down slightly to 156 cases as of 23 Jan. However, the Aedes aegypti mosquito is still high in parts of Singapore. Coupled with a sizeable proportion of people still working from home, the risk of dengue remains high in 2021. The strong support from our stakeholders and the public helped to bring down the weekly number of dengue cases from its peak of 1,792 in Jul 2020. Let’s stay vigilant in this fight against dengue! Here’s how: www.nea.gov.sg/stop-dengue

NEA Singapore

@NEASingapore · Post #137 · 03.12.2020 г., 03:41

#SGDengueUpdate 281 weekly dengue cases were reported last week, reversing the downward trend in the number of weekly dengue cases over the past 6 weeks. The Aedes mosquito population has also increased by 11% since the second week of Nov. Let’s all stay vigilant and do our part to reduce the Aedes mosquito population! Learn more: go.gov.sg/mozzieproof

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