TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #32 · 7 фев.

Скорее всего уже слышали, что складывать строки через + это плохая практика. Падение производительности, и всё такое. Без лишних слов, давайте измерять: from timeit import timeit def t1(): # складываем 10 строк через + из переменной t = 'text' for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t2(): # склеиваем список строк через метод join arr = ['text'] * 10 for _ in range(1000): s = ''.join(arr) def t3(): # складываем через + но не из переменной а непосредственно инлайн объекты for _ in range(1000): s = 'text' + 'text' + 'text' + ... # всего 10 раз Теперь каждую строку склейки запустим по 10М раз >>> timeit(t1, number=10000) 0.21951690399964718 >>> timeit(t2, number=10000) 1.4978306379998685 >>> timeit(t3, number=10000) 0.2213820789993406 Хм, а нам говорили что через "+" это плохо и медленно ))) 😁 Тут стоит учитывать, что речь идёт о склейке множества длинных строк. Давайте изменим условия: def t4(): t = 'text'*100 for _ in range(1000): s = t + t + t + t + t + t + t + t + t def t5(): arr = ['text'*100] * 10 for _ in range(1000): s = ''.join(arr) def t6(): for _ in range(1000): s = 'text'*100 + 'text'*100 + ... # всего 10 раз >>> timeit(t4, number=10000) 12.795130728000004 >>> timeit(t5, number=10000) 2.642637542999182 >>> timeit(t6, number=10000) 0.2184546610005782 Вот, уже другой разговор, сразу видна разница, в среднем в 6 раз. Но погодите, почему последний тест t6() по скорости такой же как и t3()? Ведь строки теперь в 100 раз длиннее! Это вопросы оптимизации кода, какие простые изменения ускоряют или замедляют выполнение программы. Мы столкнулись с примером обхода обращения к переменной. Например, именно так работает директива #define в С++, во время компиляции подставляя значение переменной вместо ссылки на неё. В Python это тоже работает, но часто ли вы сможете встретить такой способ работы со строками? К сожалению, способ почти только теоретический. В целом, тесты показали то, что мы хотели. Делаем выводы самостоятельно. Полный листинг 🌍 #tricks

Резултати

Пронајдени 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