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

Резултати

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

Пребарај: #great

当前筛选 #great清除筛选
America 🇺🇸 News & Politics

@America · Post #10058 · 04.11.2025 г., 02:45

😄Great ➖➖➖➖➖➖ 🔘Great is an adjective to talk about something being very big, very important or very good. 🔜We've seen great improvement in the last 10 years. 🔜This is the great question of our time. 🔜This is just a great video! 🔘We can use great with adjectives, particularly those related to large quantities or sizes to emphasise them. 🔜He caught a great big fish! 🔜They have a great many properties all over the world. 🔘Sometimes we use great as a noun, to talk about the people or things that we think are particularly important or successful. 🔜As a singer, she's one of the greats. 🔜He's one of the all-time greats of basketball. 🔜You need to study the greats of literature. #Great👨‍🏫@America ➖➖➖➖➖➖➖➖➖➖➖➖ 🆕 Crypto News @Money 😁 Crypto Game @Egame 🇺🇸 US News @America 🇯🇵 Japan News @Japan 🇦🇪 UAE News @Dubai ▶️ Popular Movies @Videos 😜 Best Funny Video @Funnys

Hashtags

Trump's Ear

@trumpsear_tg · Post #1656 · 17.10.2025 г., 14:05

Greta Thunberg said that Israel sent back her luggage with the inscriptions “Greta is a whore” and an image of penis. There is no evidence that this was drawn by the Israelis. Do you agree that Greta is a whore? #great#whore#israel 👂More on Trump's Ear ⚠️

🔥 Fidoyi ustozlar taqdirlandi! 🇺🇿 Barcha rivojlangan mamlakatlar, jumladan AQSH, Buyuk Britaniya, Yaponiya, Germaniya, Janubiy Koreya, Singapurda nodavlat ta’lim muassasalarining o‘rni beqiyos. Ta’lim tizimiga baho beruvchi, dunyo tan olgan oliy o‘quv muassasalarining jahon reytinglarida ham nodavlat ta’lim muassasalari eng yuqori o‘rinlarni egallab kelmoqda. 🚫 O‘zbekiston Respublikasi Prezidentining 2017 yil 15 sentyabrdagi “Nodavlat ta‘lim xizmatlari ko‘rsatish faoliyatini yanada rivojlantirish chora-tadbirlari to‘g‘risida”gi PQ-3276-son Qaroriga asosan Finlandiya davlati tajribasi asosida faoliyat yuritayotgan Respublika “Diagnostik test sinov” nodavlat ta’lim muassasasi tomonidan 2024 yil 24 iyul kuni “Ta’lim fidoyisi” ko‘krak nishoni ta’sis etildi. 📎 Shu maqsadda, O‘zbekiston Respublikasi Konstitutsiyasi qabul qilinganligining 32 yilligi munosabati bilan O‘zbekiston Respublikasi Vazirlar Mahkamasi huzuridagi Biznes va tadbirkorlik oliy maktabida faoliyat yuritayotgan tajribali, professional, yuqori malakaga ega bo‘lgan professor o‘qituvchilari “Ta’lim fidoyisi” ko‘krak nishoni bilan taqdirlandi. #GraduateSchool#Meeting#Teacher#Great 🔝Web-site |🔝Facebook | 🔝Instagram | 🔝Youtube