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

Резултати

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

Пребарај: #predicttowin

当前筛选 #predicttowin清除筛选
Go! Announcements

@gorwachain_announcements · Post #1200 · 21.04.2026 г., 15:19

🚀 Health Hero Announcements: Predictions Are Live on Instagram! 💪🔥 Hey Heroes 👋 Fitness is no longer just scrolling, it’s now a game you win with real predictions. Predictions Are Live on Instagram! Predict the winner in fitness matchups straight from the comments. Here’s how it works: We post a matchup on https://www.instagram.com/healthheroai You reply in the comments with who you think wins Optional: add an amount to back your pick (e.g. “100 HERO on @username”) We confirm and lock it in while the matchup is active When it closes, we announce the winner and settle the staked picks Why this matters: • More participation with less friction • Clear outcomes people can follow • Real incentives for being right • Community energy that feels like play, not noise Ready to join the next one? Reply with a pick like: • “100 HERO on @username” • “I pick @username” Drop a 🔥 if you’re in for the next matchup! Daily Check In is still LIVE! One tap in hero_predict_bot = XP + $HERO tokens every day. This week 1,000,000 $HERO being distributed! Check in on both Go and Health Hero for +40% bonus. Build streaks for massive multipliers: 7 day = 1.5x | 30 day = 2x | longer = even bigger. Community first. Fun first. Real results. Let’s make fitness addictive again the right way ❤️ Start your streak now → DM hero_predict_bot Who’s dropping the first challenge? Tag your crew 👇 #HealthHero#PredictToWin

Go! Announcements

@gorwachain_announcements · Post #1197 · 17.04.2026 г., 16:13

🚀 Health Hero Announcements: Predict. Play. Get Paid. Wellness Just Got Real! 💪🔥 Hey Hero fam 👋 Fitness is no longer just scrolling it’s now a game you win. Drop challenges on IG turn workouts into prediction markets battle your crew and stack $HERO rewards when you and your team crush it. Wealth and Health just leveled up. Predict fitness outcomes health goals and wellness wins then own the upside with real tokens. Daily Check In is LIVE! One tap in hero_predict_bot equals XP plus $HERO tokens every day. This week 1000000 $HERO being distributed! Check in on both Go and Health Hero for plus 40 percent bonus. Build streaks for massive multipliers 7 day equals 1.5x 30 day equals 2x plus longer equals even bigger. The global wellness economy is already 6.8 trillion dollars and heading to nearly 10 trillion by 2029 and we’re building the fun social rewarding layer on top. Community first. Fun first. Real results. Drop a 🔥 if you’re checking in today and ready to turn your fitness into wins! Start your streak now DM hero_predict_bot Let’s make fitness addictive again the right way ❤️ Who’s dropping the first challenge? Tag your crew 👇 #HealthHero#PredictToWin