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

Резултати

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

Пребарај: #michigan

当前筛选 #michigan清除筛选
djangoproject

@djangoproject · Post #194 · 31.10.2016 г., 12:39

https://www.coursera.org/specializations/data-science-python?utm_medium=email&utm_source=marketing&utm_campaign=2QBGEJZREeajEnVsu251ig The 5 courses in this #University of #Michigan specialization introduce learners to data science through the python programming language. This skills-based specialization is intended for learners who have basic a python or programming background, and want to apply statistical, machine learning, information visualization, and text analysis techniques to gain new insight into their data. Introduction to Data Science with Python (course 1), Applied Plotting, Charting & Data Representation in Python (course 2), and Applied Machine Learning in Python (course 3) should be taken in order and prior to any other course in the specialization. After completing those, courses 4 and 5 can be taken in any order. All 5 are required to earn a certificate.

American Оbserver

@american_observer · Post #4917 · 21.01.2026 г., 15:59

The most massive accident since the beginning of the year in the United States involving more than 100 cars in Michigan. #massive#accident#cars#michigan 📱American Оbserver - Stay up to date on all important events 🇺🇸

Pensiero Verticale

@verticale_blog · Post #574 · 29.09.2025 г., 17:57

Quando la vi*lenza diventa strumento di politica estera, prima o poi ritorna a bussare alle porte di casa. Le gu*rre combattute lontano, la retorica della libertà usata come maschera di interessi economici, l’addestramento alla disumanizzazione: tutto ciò si traduce oggi in una società che implode sotto il peso delle proprie stesse contraddizioni. La lezione è chiara: ciò che un impero esporta, inevitabilmente lo eredita. #guerra#michigan#detroit#attualita#news#oggi#america

r_iww

@r_iww · Post #4865 · 21.02.2026 г., 07:35

Chipotle Michigan Unionization with Teamsters (3 years & 6 months on) August 2022, workers at a Chipotle in Lansing, Michigan, voted 11-3 to unionize, becoming the first and only employees at the chain to ever win union recognition. Three years later, they still don’t have a contract. After years of bargaining, the Chipotle corporation and Teamsters have indefinitely paused negotiations, and workers no longer anticipate a collective bargaining agreement at their store. https://jacobin.com/2026/02/chipotle-unionization-michigan-teamsters-organizing \#Chipotle#LabourMovement#MIchigan#Organize#Teamsters#Unions https://redd.it/1r8f9ni @r_iww

Venture Village Wall 🦄

@venturevillagewall · Post #4148 · 14.02.2025 г., 10:00

New Developments in Tech and Crypto News • Russian electronic voting to become mandatory at all levels, limiting paper ballots. More info here. • VK acquires 25% of office software developer R7 for approx. 2.5–3.5 billion rubles. Read more here. • Russia sees illegitimate web traffic rise to 12%, with half from botnets. More details here. • TikTok returns to U.S. app stores after a 25-day hiatus, facing a 50-day deadline for ByteDance to divest its U.S. operations. Update here. • Apple plans to integrate AI functions in iPhones in China by May, using Alibaba's models for compliance. More info here. • Avride begins testing delivery robots with Uber Eats in Jersey City. Full update here. • Michigan lawmakers propose investing 10% of state funds in crypto. Details here. • Ethereum developers release Pectra client software before April mainnet upgrade. Check here. • Aave records its highest revenue month ever in January. See more here. • Doodles NFT project announces DOOD token on Solana, issuing 10 billion tokens, 68% for the community. Update here. • BNB Chain faces user influx challenges after CZ's controversial comments, causing a 10% drop in BNB price. More info here. • President of El Salvador, Bukele, meets with Michael Saylor to discuss Bitcoin. More details here. #E-voting #Russia#VK#R7#WebTraffic#TikTok#ByteDance#Apple#AI#China#Avride#UberEats#Crypto#Michigan#Ethereum#Aave#NFT#Doodles#BNB#ElSalvador#Bitcoin