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

Резултати

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

Пребарај: #bolivia

当前筛选 #bolivia清除筛选
Communia

@communia · Post #37152 · 05.10.2023 г., 17:44

#Bolivia. Lucha interna en el MAS acaba con la expulsión del Presidente Arce, el vice David Choquehuanca y 28 altos cargos más... y la re-entronización de Evo Morales https://www.perfil.com/noticias/internacional/el-mas-expulsa-al-presidente-luis-arce-y-propone-a-evo-morales-como-candidato-unico.phtml

Hashtags

Canal Huelga🚩

@huelga · Post #20635 · 13.01.2024 г., 10:44

#Bolivia Huelga de trabajadores de la maternidad de Percy Boland, Santa Cruz. https://www.reduno.com.bo/noticias/anuncian-paro-de-24-horas-con-movilizaciones-en-la-maternidad-por-hacinamiento-y-falta-de-items-202411291440

Hashtags

🇮🇱Bolivia ha caído, Israel se posiciona en Latinoamérica Tel Aviv y La Paz están restableciendo oficialmente relaciones diplomáticas completas, otra gran victoria para el bloque emergente de los Acuerdos de Isaac. Bolivia primero cortó lazos con Israel en 2009 y nuevamente en 2014. Una breve restauración se produjo en 2019 bajo el Gobierno interino de derecha de Jeanine Áñez, alineando a Bolivia nuevamente con Israel y EEUU. Pero en 2020, después de que el Movimiento al Socialismo (MAS) volviera al poder, las relaciones colapsaron una vez más. Tras los ataques del 7 de octubre, Bolivia cortó todos los lazos con Israel y más tarde se unió al caso de genocidio de la Corte Internacional de Justicia (CIJ) de Sudáfrica contra Israel en 2024. El mes pasado, el centrista Rodrigo Paz Pereira se convirtió en el nuevo presidente de Bolivia. Bajo su liderazgo, La Paz ahora está cambiando de rumbo y renovando relaciones diplomáticas completas con Israel. Y mientras el país se somete a Israel, el expresidente Luis Arce es puesto bajo arresto. Este es el mismo patrón que Latinoamérica ha visto repetidamente, un giro geopolítico hacia Washington y Tel Aviv seguido casi inmediatamente por enjuiciamientos contra el anterior liderazgo de izquierda. Este es el resultado de conflictos sin sentido entre aliados ideológicos en Bolivia y ahora difícilmente la derecha soltará tan fácil el poder nuevamente. En cuanto a Israel, esta es otra señal de que el marco de los Acuerdos de Isaac se está expandiendo. #bolivia ——— Únete a la lucha por la verdad en 📱Telegram 📱YouTube 📱X (Twitter)

Hashtags

POPULAR FRONT

@popularxfront · Post #6274 · 16.05.2026 г., 17:34

🇧🇴#Bolivia: Clashes broke out between miner unions, protest groups, and law enforcement in La Paz as demonstrators called for the resignation of President Rodrigo Paz amid the country’s worsening economic and fuel crisis. Protesters confronted police while attempting to enter Plaza Murillo, Bolivia’s central government square, throwing what appeared to be dynamite sticks during the clashes. Meanwhile, roadblocks and demonstrations have continued across several parts of the country, including in El Alto, with regional reports describing a deteriorating security situation as authorities attempt to restore circulation. (via @correodelsurcom on X & Reuters)

Hashtags

POPULAR FRONT

@popularxfront · Post #6062 · 27.04.2026 г., 07:44

🇧🇴#Bolivia: Footage shows the Mobile Police Unit for Rural Areas (UMOPAR) of the Bolivian Police seizing a shipment of drugs that was set to be transported by plane at the Villa Tunari airstrip in the Chapare province. A brief exchange of gunfire erupted between the police and the suspected drug traffickers, after which several bags of cocaine, weapons, and the aircraft itself were seized. (via @submundooriginal)

Hashtags

International Geographic

@internationalgeographic · Post #5704 · 23.05.2025 г., 12:54

Andes Mountains, #Bolivia The Uyuni salt marsh (Spanish: Salar de Uyuni) is a dried—up salt lake. Thanks to the development of tourism in the Uyuni salt marsh, local residents began to build hotels from salt blocks in which they can stay overnight. It is noteworthy that beds made of salt blocks keep warm very well, and it is very hot on them at night. Everything is built from salt — chairs, tables, beds, walls, floors.

Hashtags

Bolivia Mágica

@BoliviaMagica · Post #443 · 30.01.2019 г., 12:04

Bolivia, país suramericano que posee diferentes geografías y variados paisajes, muchas naciones y étnias; rico en historia, impresionante en cultura y tradiciones ancestrales. ¡Eso es magia! Bolivia corazón de Suramérica. #bolivia t.me/BoliviaMagica

Hashtags

RTDocumentary

@rtdocumentary · Post #688 · 01.05.2022 г., 14:00

#Bolivia#video May 1 is a Labor Day. The holiday is celebrated in Russia and many other countries, such as Bolivia, where even children have to work. So they’re torn between helping their parents and school. See their stories in the video, and the entire documentary film Undermined: Bolivia’s child workers. Follow: https://t.me/rtdocumentary

RTDocumentary

@rtdocumentary · Post #665 · 27.04.2022 г., 14:13

#video#Bolivia Bolivia has unusual battles – women dressed in heavy, multi-layered skirts fight each other. They’re known as Cholitas, and they pride themselves on looking their best in the ring. Outside the ring, they’re regular women: wives, mothers, business owners and even schoolgirls. But fighting is another social empowerment of indigenous women. Watch our the video to learn why women take part in such fights. Watch more Bolivian Cholita fighting in the full film The Good, the Bad and the Loco. Follow: https://t.me/rtdocumentary

RTDocumentary

@rtdocumentary · Post #558 · 28.03.2022 г., 15:00

#video#Bolivia Salar de Uyuni is the world’s largest salt flat. It covers 11,000 square kilometres. Locals call it ‘God’s Mirror’. When salt was in great demand, it was essential. But now the situation has changed. In the late 1980s, vast lithium reserves were found at the salt flat, some of the biggest in the world. Lithium sometimes referred to as ‘21st-century oil,’ is an essential raw material needed to manufacture batteries. But unfortunately, lithium extraction pollutes the atmosphere and seriously disrupts the ecosystem. Still, saleros continue their work even risking their health because salt has become their whole life — they earn their living extracting it, making art pieces of it and even building salt houses. You can watch the full documentary on @documentaryplanet Follow: https://t.me/rtdocumentary

ПретходнаСтраница 1 од 4Следна