@tsukassadrive · Post #2764 · 24.06.2025 г., 20:02
#textpost ESCAPISTS ONLY
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
Пребарај: #textpost
@tsukassadrive · Post #2764 · 24.06.2025 г., 20:02
#textpost ESCAPISTS ONLY
Hashtags
@tsukassadrive · Post #1941 · 05.08.2024 г., 07:46
#textpost going through some shit rn, but that doesn't mean I have to stop posting...
Hashtags
@tsukassadrive · Post #2972 · 14.12.2025 г., 06:09
#textpost#y2k Pro Tip: Instead of looking for an music with a "y2k aesthetic", just listen to a music from 2000s. HUGE time saver.
@tsukassadrive · Post #2711 · 02.05.2025 г., 00:48
#textpost#random "dreams become real, and what once was real become a dream"
@tsukassadrive · Post #1989 · 12.08.2024 г., 14:29
#random#textpost Pentagon - Collapse (ICO Ost)
@tsukassadrive · Post #2781 · 31.07.2025 г., 23:15
#textpost#random#weebshit CICORU DONMAI! CICORU DONMAI!
@tsukassadrive · Post #1626 · 20.05.2024 г., 07:42
#random#textpost#meme#original I heard you is a doomer, nigga. The world cherishes you, nigga. The world is still when you out of hustle and bustle of the human discourse, nigga. This stillness is boundless, nigga. This stillness makes life worth living, nigga. The world is indeed filled with despair and pain, nigga, but as to counter it, the world is filled with the wonder you can't even imagine, nigga. But don't go filtering out your ordinary life for them life's highs and lows, nigga. Just as you read this text, in this most ordinary moment, you don't experience any of your life's problems, nigga. You have time to read this pasta on the internet, nigga, so don't give in to your thought-autopilot and regain control of your life that is right now, nigga, not in the not-yet existing future or the past that only was, nigga.
@tsukassadrive · Post #1891 · 29.07.2024 г., 10:58
#random#music#textpost#upload
@tsukassadrive · Post #1559 · 01.05.2024 г., 07:45
#random#textpost#music#upload source When I close my eyes, it's a fantasy Perfect plastic life from a magazine Then, when I wake up, it's reality (pretty girls) I can have it all (yeah), live my цикорiй dreams (Kaliii)
@DESI_MEMES_Funny_Jokes · Post #5894 · 29.11.2024 г., 09:04
Dost ko v Lana chahiye tha 🌚 . . . . Tags-#quotesdaily#quote#quotestagram#quotesaboutlife#quoteoftheday#quotes#aesthetic#fypage#fypシ#explore#explorepage#relatabletextpost#relatablequotes#relatable#textpost#thoughtoftheday#thoughts#funnyquotes#funny#trending#bollywoodsongs#bollywood#feed#relatableshit#lovemoments💕#meandher#meandhim❤️#mostloved#manifesting
Hashtags
@DESI_MEMES_Funny_Jokes · Post #5888 · 28.11.2024 г., 16:45
Chaliye swarg se ghum kr aate h 😂🤡 . . . . Tags-#quotesdaily#quote#quotestagram#quotesaboutlife#quoteoftheday#quotes#aesthetic#fypage#fypシ#explore#explorepage#relatabletextpost#relatablequotes#relatable#textpost#thoughtoftheday#thoughts#funnyquotes#funny#trending#bollywoodsongs#bollywood#feed#relatableshit#lovemoments💕#meandher#meandhim❤️#mostloved#manifesting
Hashtags
@DESI_MEMES_Funny_Jokes · Post #5543 · 24.10.2024 г., 13:23
Bolo n chup kahe ho 😆✊🏻 . . . . Tags-#quotesdaily#quote#quotestagram#quotesaboutlife#quoteoftheday#quotes#aesthetic#fypage#fypシ#explore#explorepage#relatabletextpost#relatablequotes#relatable#textpost#thoughtoftheday#thoughts#funnyquotes#funny#trending#bollywoodsongs#bollywood#feed#relatableshit#lovemoments💕#meandher#meandhim❤️#mostloved#manifesting
Hashtags