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

Резултати

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

Пребарај: #valentine

当前筛选 #valentine清除筛选
Everything Science

@everything_science · Post #3290 · 17.02.2025 г., 07:44

Single man in china once booked every other seat in a cinema theatre to split up couples on valentine's day. #Valentine 🔔@Everything_Science

Hashtags

🦅 [ perspective ix ]

@perspectiveix · Post #1110 · 14.02.2018 г., 20:00

​​❤️ Valentine's Day 2018 - The Cost Of Love Love it or loathe it, #Valentine's Day is an important date for the 🇺🇸 economy. According to the National Retail Federation (NRF), the average American will spend $143.56 on gifts this year, with total planned nationwide spending $19.6 billion. 55% of people are going to celebrate with jewelry ($4.7 billion), an evening out ($3.7 billion) and flowers ($2.0 billion) the top spending categories. 🚀@PerspectiveIX 🌀 ⁣http://prs.pctvix.co/TelegramIX

Hashtags

🚀 LAUNCH DAY #VALENTINE is going to enter the market. Chart’s will heating up. 📜 Contract: 0x3942B1e2F8B4B2d7921CE49A1fC0f805295F381C 💰 Tax: 3/3 🚀 Launching on 8/8 at 12:00 PM UTC ⏰ ➡️Ave on Broad ➡️Top trending booked ➡️#Valentine updated on #Dextool 🟢Chart: https://www.dexview.com/bsc/0x3942B1e2F8B4B2d7921CE49A1fC0f805295F381C ✉️Telegram https://t.me/bsc_Valentine 🐦Twitter https://x.com/bsc_Valentine

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40655 · 13.02.2026 г., 23:01

Saint Valentine’s Day, or simply Valentine’s Day, is celebrated on the 14th of February, but primarily in western societies. The day has been named after one or more martyrs of the early Christian era named Valentine or Valentinus who lived sometime in the 3rd century CE and were killed for defying oppressive laws directed either against Christians or young lovers in the Roman Empire. [read more here] @googlefactss#history#love#Valentine

APKPure_Official

@apkpurechannel · Post #2873 · 21.02.2026 г., 11:31

🔥💗Grow a Garden #Valentine Part 2 Event 👀#Leak 🚀💘Feb 22 - Mar 1 💕💕More Hearts!! Expect a huge variety of new Valentine's-themed cosmetics In the Valentine's part 2 update! With all these new features, you'll create heart-filled gardens, plus a brand-new quality-of-life update for the Heart Blossom Seed and much more in Grow a Garden! 💕💕💕 #gag#trade🌞#growagarden❤️#valentine🐝#garden 📅🎁Check out GAG Giant pet giveaways on TradeKitsune. Add @APKFreeDownloader_Bot to get any apk you want.

Kraze magazine Instagram Update Vogue Korea has released its February 2026 issue with Jimin as the main cover star. This edition, released in February, carries a Valentine’s theme and features a visual concept highlighting Jimin’s artistic character and personal identity. After Vogue published the February 2026 cover, Jimin ranked number one in global trending topics. Follow @kraze.official for daily and reliable updates on K-pop news, trends, events, and everything in between! 💌 [email protected] Source: Vogue Korea #Jimin#BTS#Vogue#VogueKorea#Valentine -@All_BTS_Updates