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

Резултати

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

Пребарај: #transparency

当前筛选 #transparency清除筛选
PizzApp Design - Wallpapers & Icon Packs

@pizzapp_design · Post #7729 · 14.05.2026 г., 10:50

♾️#Transparency#IconPack Limited Time SALE 🎉 📲 Codes WLH0A5YS6KL0M6MMAWXH9NZ 6Y3T4E6KJTW3BPSQ40GB2X7 7KX00KFBLVMEHMS7JCX8DVU GDX1LQ8SARD78Q85MR51WPC STBJNPFEP3QNBE0XYVKVYZN FYLFUE2ZPW2MMBP2Q9S9TTF KJSEPH59SDYGAM9T28Q7Z9G NFTCRKMP8057CL9054DAT2Q 1M6PDFEXWHL0EW80P2AMNHU 09BBT4LBN8048BK0H68WH6D 🖥Download Here ⭐️Rate & Review to support me!

America 🇺🇸 News & Politics

@America · Post #10401 · 20.03.2026 г., 13:03

🚨💰IRS GLITCH HIDES $51M IN POLITICAL DONATIONS 🔹 Technical error masks campaign contributions to state-level groups for Q4 2025 📊 🔹 Republican Attorney General's Association, RSLC affected - $41M in donations missing 💸 🔹 IRS workforce cut 27% by DOGE efficiency drive - system failures mounting rapidly 🏛️ 🔹 527 organizations face April 15 deadline with completely broken e-filing system ⏰ 🔹 Center for Political Accountability warns of "complete black hole" in transparency 🕳️ 🔹 Affected groups include RGA ($32M), DLCC - major election funding obscured 📋 The most transparent democracy? More like broken bureaucracy failing voters 😤🇺🇸 #USNews#politics#transparency @america

AI & Law

@ai_and_law · Post #308 · 16.05.2024 г., 07:04

Microsoft Touts Responsible AI Efforts in New Report Microsoft released a comprehensive report, the "Responsible AI Transparency Report," detailing its initiatives for developing and deploying responsible Artificial Intelligence technologies. The report highlights Microsoft's commitment to building safe and responsible generative AI, a field where the company has actively pursued innovation. Microsoft emphasizes its safety efforts, including: ✅ Launching over 30 tools to empower developers with responsible AI practices. ✅ Providing more than 100 features within Azure to assist customers in deploying safe AI solutions. ✅ Expanding its responsible AI community by 17%, now exceeding 400 members. ✅ Mandating responsible AI training for all employees, with a 99% completion rate for relevant modules. The report concludes with a commitment from Microsoft to invest further in responsible AI development tools for its customers. #ResponsibleAI#Transparency

AI & Law

@ai_and_law · Post #593 · 17.06.2025 г., 07:04

🇺🇸When “AI-First” Means 700 Humans Behind the Curtain BuilderAI, a Microsoft-backed startup once hailed as a pioneer in “AI-powered app creation,” has reportedly gone bankrupt — and not for lack of demand. While the company promoted itself as using artificial intelligence to automate software development, recent revelations show that it relied heavily on a workforce of 700 people in India to do the work manually. #AI ##ResponsibleAI#Transparency

123•••56
ПретходнаСтраница 1 од 6Следна