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

Резултати

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

Пребарај: #sergeylavrov

当前筛选 #sergeylavrov清除筛选

@RusEmbMalta Press Release 🇷🇺Interview of Russian Foreign Minister Sergey Lavrov with Turkish Media 📍Moscow, 29 January 2026 On 29 January 2026, Russian Foreign Minister Sergey Lavrov gave an interview to Turkish media, outlining Russia’s principled assessment of the situation around Ukraine, the role of the West, and the prospects for a sustainable security architecture. 🔹 Key points 🧭 Ukraine and the West Russia views the Ukrainian conflict as part of a broader confrontation with the West. Ukraine has been turned into a pawn – a tool used to build a military bulwark along Russia’s borders, creating direct threats to Russian security. 📜Breach of Ukraine’s founding principles Ukraine’s Declaration of Independence explicitly enshrined non-alignment, neutrality and renunciation of nuclear weapons. It was precisely these principles that formed the basis on which Russia – along with most countries worldwide – recognised Ukraine after the dissolution of the Soviet Union. 🔹A conflict prepared in advance The crisis in Ukraine was not spontaneous. It was carefully prepared and financed, including by the United States. As former US Deputy Secretary of State Victoria Nuland has acknowledged, around USD 5 billion was spent to engineer a coup and transform Ukraine into an “anti-Russia” project. ⚠️ A tragic repetition of history The Zelensky regime represents a grim repetition of history — not a farce, but a tragedy, given the immense human toll. Many lives have been sacrificed by the regime and its Western patrons. ⛔Ceasefire proposals Russia considers unacceptable the repeated calls by Zelensky for a ceasefire of 60 days or longer. Past experience shows that such pauses were consistently exploited to rearm Ukraine, mobilise new recruits by force, regroup troops and prolong the conflict. 🕊️Missed opportunity in Istanbul (April 2022) Concrete and honest security guarantees were formulated during negotiations in Istanbul, hosted by Türkiye. These included the absence of foreign military bases on Ukrainian territory and restrictions on military exercises involving external forces. Everything was agreed in detail – but the process was blocked after external political interference. 📄So-called “peace plans” Russia has not seen the “20-point plan” repeatedly referenced by Zelensky. As understood, it has since been reworked by Ukraine and certain European states and is now being promoted as an alternative “vision” of peace. 🌍Multipolar world Russia does not oppose states that firmly defend their national interests. On the contrary, a truly multipolar world can only emerge through self-respecting states guided by common sense — states that defend their own interests while respecting those of others. 🔗 Full text of the interview: 👉here. #RussiaTürkiye #SergeyLavrov #UkraineCrisis

ሰርጌይ ላቭሮቭ ለ130ኛው የዓድዋ ድል በዓል የእንኳን አደረሳችሁ መልዕክት አስተላለፉ ******************** የሩሲያ የውጭ ጉዳይ ሚኒስትር ሰርጌይ ላቭሮቭ ለኢፌዴሪ የውጭ ጉዳይ ሚኒስትር ጌድዮን ጢሞቴዎስ (ዶ/ር) እና ለመላው የኢትዮጵያ ሕዝብ ለ130ኛው የዓድዋ ድል በዓል የእንኳን አደረሳችሁ መልዕክት አስተላልፈዋል። የውጭ ጉዳይ ሚኒስትሩ በመልዕክታቸው፤ የዓድዋ ድል በአፍሪካ ታሪክ አንዲት ሀገር በቅኝ ገዥ ኃይል ላይ የተቀዳጀችው የመጀመሪያው ድል በመሆኑ በዓለም አቀፍ ደረጃ ከፍተኛ ተጽዕኖ የፈጠረ መሆኑን ገልጸዋል። ድሉ የኢትዮጵያውያንን የጽናት መንፈስ ከማረጋገጡ ባለፈ በመላው አፍሪካ ለሚካሄዱ የነፃነት ትግሎች መነሻ መሆኑንም አክለዋል። ሩሲያ እና ኢትዮጵያ ለረጅም ዘመናት የዘለቀ የወዳጅነት ታሪክ እንዳላቸው የጠቀሱት ሰርጌይ ላቭሮቭ፤ በየተለያዩ ዓለም አቀፍ ድርጅቶች በተለይም በተባበሩት መንግሥታት ድርጅት እና በብሪክስ ማዕቀፍ ውስጥ ፍትሃዊ የዓለም ሥርዓት እንዲኖር በጋራ እየሠሩ መሆኑን ጠቁመዋል። በተጨማሪም በሁለቱ ሀገራት መካከል በንግድ፣ በኢኮኖሚ፣ በሳይንስ እና በባህል ዘርፎች ትብብሮች እያደጉ መሆናቸውን መግለጻቸውን የሩሲያ የውጭ ጉዳይ ሚኒስቴር መረጃ አመልክቷል። በኢትዮጵያ የኒውክሌር ኃይል ማመንጫ ግንባታን ጨምሮ፣ የደጃዝማች ባልቻ ሆስፒታልን መልሶ መገንባት እና የጋራ ባዮሎጂካል ምርምር ማዕከል መመሥረት ዋና ዋናዎቹ የትብብር ፕሮጀክቶች መሆናቸውን ሚኒስትሩ በመልዕክታቸው ጠቅሰዋል። #EBC#Ethiopia#Russia#Adwa130#Diplomacy#SergeyLavrov#GedionTimotheos#BRICS