@everything_science · Post #3861 · 04.01.2026 г., 18:55
The wolverine mask is basically batman kissing batman in front of Iron man. #legendary 🔔@Everything_Science
Hashtags
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
Пребарај: #legendary
@everything_science · Post #3861 · 04.01.2026 г., 18:55
The wolverine mask is basically batman kissing batman in front of Iron man. #legendary 🔔@Everything_Science
Hashtags
@everything_science · Post #3857 · 31.12.2025 г., 08:54
Tired of getting viruses? Do this. Clean your motherboard daily to make sure those viruses get wiped off your computer forever. #legendary 🔔@Everything_Science
Hashtags
@everything_science · Post #3435 · 05.05.2025 г., 07:49
By writing "sorry" at the bottom of your math test, your teacher will feel sorry for you and probably pass you. #Legendary 🔔@Everything_Science
Hashtags
@everything_science · Post #3350 · 23.03.2025 г., 09:37
Virgin Airlines has announced that from July 2017 they will also be accepting passengers who are not virgins any more. #Legendary 🔔@Everything_Science
Hashtags
@everything_science · Post #3344 · 19.03.2025 г., 18:14
This poor man passed away yesterday when his family couldn't remember his blood type. As he died, he kept insisting for his children to "be positive" What a caring father. A loving man. #Legendary 🔔@Everything_Science
Hashtags
@everything_science · Post #3273 · 10.02.2025 г., 18:25
During child birth, the pain is so intense that women are almost capable of feeling what a man feels when he hears "I love you as a friend" #Legendary 🔔@Everything_Science
Hashtags
@everything_science · Post #3264 · 04.02.2025 г., 11:03
"Peeing in the sink is actually the green way to go, so you're welcome. Instead of wasting 1.6 gallons of water on a flush, you pee in the sink. You then wash your hands in that very same sink, simultaneously washing down the urine and preserving nature's most precious resource." #Legendary 🔔@Everything_Science
Hashtags
@everything_science · Post #3257 · 02.02.2025 г., 07:41
PEARL HARBOR was an inside job, there's no way Japanese planes could've flown THIS distance in 1931. Wake up retards and realise your government has been lying to you, JAPAN is innocent #Legendary 🔔@Everything_Science
Hashtags
@everything_science · Post #3255 · 01.02.2025 г., 07:43
Did you know ? In the 90s Arsenal Soccer Club had a player called David Dicks. When he was injured, the Newspaper wrote"Arsenal to play without Dicks". The coach was upset so the Newspaper changed the headline to read "Arsenal to play with Dicks out"... A record number of women attended the match. #Legendary 🔔@Everything_Science
Hashtags
@everything_science · Post #3251 · 31.01.2025 г., 09:56
Start arguing with your girl now so you don't have to waste money on Valentine's Day. #Legendary 🔔@Everything_Science
Hashtags
@everything_science · Post #3248 · 30.01.2025 г., 08:16
name ur daughter lizard then give her the nickname Liz and people will b like oh that's short for Elizabeth? and she'll be like no my name is lizard #Legendary 🔔@Everything_Science
Hashtags
@everything_science · Post #3209 · 16.01.2025 г., 12:15
When you sneeze and fart at the same time, your body takes a screenshot. #Legendary 🔔@Everything_Science
Hashtags