@PellostyleBiology · Post #681 · 09.05.2018 г., 00:18
#penguins
Hashtags
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
Пребарај: #penguins
@PellostyleBiology · Post #681 · 09.05.2018 г., 00:18
#penguins
Hashtags
@NatureTravelVacationPictures · Post #1129 · 09.05.2019 г., 00:30
🌿❤️✨🍃 #Penguins#Nature 💁Join Us ✅🔜@Discover_Nature 🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃
@naturetravelvacationpictures · Post #503 · 07.04.2019 г., 18:30
🌿❤️✨🍃 Lovely Couple😍😍😍🐧🐧 #Penguins#Nature Join Us ✅🔜@Discover_Nature 🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃🍃
@wildthemestelegram · Post #1738 · 27.11.2024 г., 04:34
Penguins #black #yellow #orange #white #penguins #art ᅠ𝐖𝐢𝐥𝐝 𝐓𝐞𝐥𝐞𝐠𝐫𝐚𝐦 𝐓𝐡𝐞𝐦𝐞𝐬 ᅠ═──═⌘═──═ᅠ
@tonlines · Post #7149 · 09.05.2025 г., 17:12
⚡️TON Community: Pudgy Penguins Launches Pengu Clash #TON#Penguins#Elympics TON Community announces the launch of Pengu Clash by Pudgy Penguins on TON. This real-time multiplayer game offers customizable Penguin teams and competitive arenas, with pre-registration opening on May 9. The game will kick off once the waitlist reaches 1 million participants. Source: link @tonlines
@googlefactss · Post #40974 · 25.04.2026 г., 14:01
Penguins have several group names. A group in water is called a “raft.” On land, it is called a “waddle.” A large group of penguins living or breeding together is called a “colony.” The place where they gather to breed is also called a “rookery.” 🐧🌊🏝️🐣 [Read more] @googlefactss #Penguins#AnimalFacts#Wildlife#DidYouKnow
@sarconsulurals · Post #2753 · 02.11.2025 г., 05:16
🖼Boulders Beach — Penguins on the Beach! 🌊 The beautiful Boulders Beach is one of Cape Town’s most visited and the only place in the world where you can get this close to African penguins. 🐧 The Boulders Penguin Colony in Simons Town is home to a unique and endangered land-based colony of African Penguins — one of only a few in the world. This site has become a famous international tourist destination. The Boulders section of Table Mountain National Park consists of three pristine beaches, one penguin-viewing area, and three wooden boardwalks — built to let visitors admire these wonderful birds while keeping them safe. Thanks to the huge boulders that shelter the cove from currents, wind, and waves, it’s one of the best spots in Cape Town for both penguins and people. 🌴 🎥 Watch the video: https://www.youtube.com/watch?v=yDiVyXEbiNE #SouthAfrica#CapeTown#Tourism#Leisure#Nature#Travel#Penguins
@sarconsulurals · Post #2841 · 30.11.2025 г., 04:15
Где живут пингвины?🐧🌍 Студент из ЮАР Ассуа Ака в коротком видео (0:40) на отличном русском языке расскажет вам об этом. #Природа#Пингвины#Кейптаун ___________________ Where do penguins live? 🐧🌍 A student from South Africa, Assua Aka, will tell you about it in good Russian in a short (0:40) video. #Nature#Penguins#CapeTown 📹https://t.me/tvbrics/8262
@wangzhuanzhan · Post #33226 · 20.09.2024 г., 06:59
M-m马m达d加j斯s加j的d企q鹅e- 马达加斯加的企鹅 Penguins of Madagascar (2014) 直达链接:https://pan.quark.cn/s/382656d846e8 #马达加斯加的企鹅#Penguins of Madagascar #马达加斯加爆走企鹅#荒失失企鹅 链接:https://link3.cc/sf_com #电影#喜剧#美国#10年代