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

Резултати

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

Пребарај: #synonyms

当前筛选 #synonyms清除筛选
Toward Discovering English

@TowardDiscoveringEnglish · Post #564 · 09.09.2021 г., 12:00

Synonyms : 1. Bizarre = strange 2. Fanciful = unrealistic 3. Feat = difficult achievement 4. Impair = damage 5. Deter = prevent 6. Fracture = break 7. Indigenous = native 8. Altitude = height 9. Keen = intelligent 10. Dominate = control #synonyms

Hashtags

Toward Discovering English

@TowardDiscoveringEnglish · Post #563 · 09.09.2021 г., 11:59

Synonyms: 1 Backing = support (n) 2 Devastating = disastrous (adj) 3 Regarding = concerning = about (prep) 4 Compel = force (v) 5 Relinquish = give up = stop (v) 6 Tolerate = put up with (v) 7 Rejuvenate = refresh (v) 8 Dense = tight (adj) 9 Appall = horrify (v) 10 Allot = give (v) ▪︎Try to give examples by using these synonyms in full sentences with an appropriate approach. Example: We cannot put up with your behaviour, so you are going to be expelled from our university. #synonyms

Hashtags

Learn RCRussian🤍💙❤️

@learnrcrussian · Post #4371 · 19.03.2025 г., 07:43

👋Доброе утро, товарищи! 🔻To answer the most anticipated question now: Когда??? (when?) • Скоро (adverb) [sko-rа] Soon • В ближайшем будущем (formal) [v bli-zhay-shem bu-du-shchim] In the near future • На подходе (colloquial) [na pat-kho-de] Approaching, on its way 📎 During a phone call yesterday, Trump endorsed Putin's idea to organize hockey games in the US and Russia between NHL and KHL players. 😉Ждём? 🎧🗣👇 #useful_vocabulary #synonyms #politics #news 😎 Stay with @learnRCRussian

Learn RCRussian🤍💙❤️

@learnrcrussian · Post #4805 · 07.06.2025 г., 14:45

Матерь котья! Бесконечный лоток! Holy Cat Mother! Endless litter box! • Бесконечный (masc.adj.) [bis-ka-nech-nyj] Synonyms (masc.adj.): • Безграничный [biz-gra-nich-nyj] Boundless, limitless, infinite, unbounded • Нескончаемый [nis-kan-cha-yi-myj] Endless, unending, interminable, incessant • Непрерывный [ni-pri-ryv-nyj] Continuous, uninterrupted, unbroken, constant ❗️Note that the prefixes БЕС- and БЕЗ- mean the absence of something, and their choice depends on the following letter: 🔻if it's a vowel or a letter representing a voiced consonant, use БЕЗ-; 🔻if it's a voiceless consonant, a sibilant, or ц, use БЕС-. 🔻Don't forget to ->❤️ this post, please! 🎧🗣👇Всем нескончаемой субботы😉! #useful_vocabulary #adjectives #synonyms #prefixes 😎RCR | Support | Boost

Learn RCRussian🤍💙❤️

@learnrcrussian · Post #4446 · 03.04.2025 г., 09:56

👋Приветствую всех, кто ещё в строю! 🔢🔢🔢Synonyms for the adjective▶️пушистый: 1. Мохнатый [makh-ma-tyj] Shaggy, fluffy • Мохнатый пудель (masc.) A wooly poodle 2. Лохматый [lakh-ma-tyj] Tousled, shaggy • Лохматые брови (plural) Shaggy eyebrows 3. Мягкий [myakh-kiy] Soft • Мягкий плед (masc.) A soft blanket 4. Плюшевый [plyu-shy-vyj] Plush, soft • Плюшевая ткань (femin.) Plush fabric 5. Пуховый [pu-kho-vyj] Downy • Пуховый платок (masc.) А downy shawl, headscarf ❓Do you know any other synonyms? 🎧🗣👇 #365_marathon #survive_in_Russia #adjectives #synonyms 😎 Stay with @learnRCRussian

Learn RCRussian🤍💙❤️

@learnRCRussian · Post #5354 · 29.08.2025 г., 09:01

🔢🔢🔢Synonyms for the verbВзорваться (all perfective aspect verbs): 1. Взорваться [vzar-va-tsa] To explode, burst up, go up, detonate 😄conjugation 🔻The standard, neutral term for a violent explosion. 2. Разорваться [ra-zar-va-tsa] To burst, to blow up, to rupture 😄conjugation 🔻Often implies a blast from within, causing something to break apart. 3. Сдетонировать [zde-ta-ni-ra-vat'] To detonate 😄conjugation 🔻A more technical, scientific term for a rapid, explosive reaction. 💢Colloquial variants: 4. Бумкнуть (onomatopoeic) [boomk-nut'] To go boom, to kaboom 😄conjugation 🔻A playful, childish word imitating the sound of an explosion. 5. Бухнуть (onomatopoeic) [bukh-nut'] To go bang/to thud/to blow up 😄conjugation 🔻Imitates a duller, heavier sound (like an explosion or a collapse). 6. Громыхнуть (onomatopoeic) [gra-mykh-nut'] To go crash, to boom, to rumble 😄conjugation 🔻Imitates a loud, crashing, thunderous noise. 🔻The suffix -НУ- typically indicates a single, perfective action. Example (video): • Пивная кега взорвалась под уфимцем. Никто не пострадал. Ну, кроме самого пива. The beer keg exploded under the Ufimets. No one was hurt. Well, except for the beer itself. Don't forget to ->❤️ this post, please! 🎧🗣👇Всем спокойной пятницы без взрывов! Video: videodozor #365_marathon #survive_in_Russia #verbs #synonyms #video_from_subcriber 😎RCR | Support | Boost