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

Резултати

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

Пребарај: #communardunion

当前筛选 #communardunion清除筛选
Venezuelanalysis

@venanalysis · Post #2018 · 01.07.2025 г., 20:24

📝 INTERVIEW | Juan Lenzo: ‘We Need to Integrate the Communal Economy to Face the Capitalist Maelstrom’ Juan Lenzo, a Venezuelan activist, takes stock of the Communard Union’s current strengths and challenges, with a particular focus on consolidating the communal economy. Today, 117 communes are part of the Union. To strengthen economic planning, the organization is mapping grassroots productive activity and identifying opportunities to rebuild the communal economy after years of crisis. One of its flagship efforts is the “Patria Grande del Sur” project in Bolívar state: a 187,000-hectare initiative developed with Brazil’s MST and local campesino communities. The goal is to build a communal agroecological system in phases, from infrastructure to production and education. “We’re not trying to strengthen the old state, we’re building a communal one,” he said. 🔗 Read the full interview here: https://shorturl.at/wejdV #CommunardUnion#Communes

Venezuelanalysis

@venanalysis · Post #1468 · 05.02.2024 г., 16:58

The Communard Union has deployed its “Argelia Laya Brigade” across the country in a bid to strengthen the organization and links between popular power collectives. Beginning on February 4, the activists are divided into "exploratory" and "permanent" brigades, with the former spending two weeks in specific territories and the latter committing to a six-month presence in priority areas as identified by the Communard Union. Their primary objective is to assess political, social, and economic conditions within the visited communes, aiming to formulate work plans that enhance organizational structures and integrate them into the Communard Union. Click here to see the gallery 👉🏽https://venezuelanalysis.com/images/venezuela-communard-union-launches-territorial-brigades/ #Venezuela#CommunardUnion#Communes

Venezuelanalysis

@venanalysis · Post #1587 · 29.05.2024 г., 22:11

🎙 Episode 25 of the Venezuelanalysis Podcast is now available! Venezuela’s revolutionary leader Hugo Chávez defined the commune as the “unit cell” for the construction of socialism. But the road ahead is full of challenges, even more so in a context of imperialist sanctions. In this episode, host José Luis Granados Ceja is joined by fellow VA member Cira Pascual Marquina and by Communard Union communications coordinator Juan Lenzo to discuss the present struggle to strengthen the communal economy and uphold the socialist horizon. Click here to listen to the full episode 👉🏼https://shorturl.at/gf26s #communardunion#communes#vapodcast

Venezuelanalysis

@venanalysis · Post #1935 · 12.04.2025 г., 00:29

📝 INTERVIEW | Communal Feminism in Venezuela: A Conversation with Moira Blanco Cardona The “communal feminism” project emerged from the experiences of women building popular power at the local level. “Communal feminism is the legacy of women who carried gas cylinders, distributed food, and recovered ancestral knowledge,” states Moira Blanco Cardona of the Communard Union. 🔗 Read more in the latest VA interview here: https://venezuelanalysis.com/interviews/communal-feminism-in-venezuela-a-conversation-with-moira-blanco-cardona #CommunalFeminism#CommunardUnion

Venezuelanalysis

@venanalysis · Post #1922 · 31.03.2025 г., 15:31

📸 IN IMAGES | Venezuela: 1,600 Women Discuss ‘Communal Feminism’ at First National Gathering On March 29, more than 1,600 women took part in the Communard Union’s first national gathering on communal feminism in Caracas. The meeting set four key priorities: developing a feminist economy, strengthening healthcare, eliminating gender-based violence, and expanding political participation. A commission was appointed to oversee these initiatives, with annual follow-up meetings planned. 🔗 Don’t miss the full gallery here 👉🏼https://venezuelanalysis.com/images/venezuela-1600-women-discuss-communal-feminism-at-first-national-gathering/ #CommunardUnion#Communes#Feminism

Venezuelanalysis

@venanalysis · Post #2138 · 13.10.2025 г., 19:25

📸 IN IMAGES | Venezuela: Communards Gather to Make ‘Communal Feminism’ a Priority From October 4 to 6, dozens of women representing around 20 communes gathered in Miranda state for a communal feminism meeting organized by the Communard Union and the Ministry of Communes’ School for the Strengthening of Popular Power (EFPP). The gathering addressed the collectivization of care work, feminist economy, political participation, and the prevention of gender-based violence. Organizers agreed to replicate the experience across different regions. 🔗 Don’t miss the full gallery here 👉🏼https://shorturl.at/s4WUS #CommunalFeminism#CommunardUnion#Communes

Venezuelanalysis

@venanalysis · Post #2083 · 01.09.2025 г., 18:13

📰 NEWS | Venezuela: Popular Organizations Push Direct Distribution Routes to Boost Food Security Pueblo a Pueblo and the Communard Union are providing affordable access to fish and vegetables by connecting popular organizations. Pueblo a Pueblo delivered 1,000 packs of fish and seafood, each weighing 3.8 kilograms, in Caracas, Yaracuy, Lara and Trujillo. The packages, sold at $13, represented savings of 50–60% compared to local markets. At the same time, the Communard Union transported 3.5 tons of vegetables from Trujillo to communes in Lara state. Between 500 and 600 people purchased potatoes, carrots, onions and tomatoes at prices around 40% below market levels. Both initiatives strengthen direct distribution routes between producers and communities. 🔗 Read the full report: https://shorturl.at/3HDgP #CommunardUnion#FoodSovereignty#PopularPower#PuebloaPueblo