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

Резултати

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

Пребарај: #satellites

当前筛选 #satellites清除筛选
Amazing Geography 🌍

@amazingeo · Post #640 · 18.02.2026 г., 20:31

🌍 Modern cartographers use remote sensing from satellites to create digital maps so detailed they can track changes in forests, cities, and coastlines within days of new data. ✨ #cartography⚡#mapping⚡#satellites⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #377 · 15.10.2025 г., 20:31

🌍 The biggest map ever made is the modern digital world map stored by satellites. Billions of points are updated daily, letting scientists watch Earth’s surface change almost in real time. ✨ #cartography⚡#satellites⚡#mapping⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #146 · 30.08.2025 г., 20:12

🌍 In 2000, the complete first digital map of Earth—called the SRTM—was created from space using radar. It captured mountain heights and landscape details for over 80% of Earth’s land. ✨ #mapping⚡#cartography⚡#satellites⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

Amazing Geography 🌍

@amazingeo · Post #218 · 11.09.2025 г., 16:12

🌍 Satellites can use infrared sensors to spot underground water by detecting tiny temperature differences on Earth's surface, helping find hidden aquifers in dry regions. ✨ #satellites⚡#remote⚡#mapping⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography🌍 ​

Amazing Geography 🌍

@amazingeo · Post #488 · 01.12.2025 г., 20:31

🌍 Recent satellites can map changes in Earth's gravity from space. This helps track shifting water underground after floods or droughts, revealing hidden changes on a continental scale. ✨ #remote-sensing ⚡#satellites⚡#hydrology⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

MALI 24

@kamissokosekou3 · Post #37476 · 04.05.2026 г., 12:19

Le Pentagone a demandé aux entreprises de satellites de cacher des images de bases américaines détruites au Moyen-Orient 🛰. La société Planet Labs a confirmé cette demande, a déclaré la journaliste américaine Ana Kasparian 🗣. La réponse officielle du Pentagone était la suivante: “nous ne discutons pas de l'évaluation des dommages au combat pour des raisons de sécurité opérationnelle 🛡. Nos forces restent pleinement opérationnelles et nous continuons à remplir notre mission avec la même préparation et la même efficacité au combat 💪”. En même temps, CNN, citant sa propre enquête, a déclaré qu'au moins 16 bases américaines avaient été détruites et devenues inutilisables, ce qui représente la plupart des bases de la région 📉. #pentagone#entreprises#satellites#images

Amazing Geography 🌍

@amazingeo · Post #639 · 18.02.2026 г., 12:31

🌍 New satellite sensors can track wildfires as they ignite, mapping heat signatures from space day and night. This real-time data helps firefighters respond faster to changing fire fronts. ✨ #satellites⚡#remote-sensing ⚡#wildfires⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #451 · 13.11.2025 г., 12:31

🌍 Some satellites can track how much land sinks or rises after an earthquake by detecting tiny changes—sometimes less than a centimeter—across entire regions from hundreds of kilometers above Earth. ✨ #satellites⚡#remote-sensing ⚡#geodesy⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #299 · 26.09.2025 г., 15:31

🌍 Satellites now measure plant health from space by tracking tiny shifts in leaf color. This "vegetation index" helps predict crop yields and monitor droughts across continents. ✨ #remote⚡#sensing⚡#satellites⚡#agriculture⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

Amazing Geography 🌍

@amazingeo · Post #682 · 05.04.2026 г., 20:31

🌍 The newest satellites can now measure tiny changes in tree height worldwide. This helps track forest health and spot illegal logging by comparing images taken months or even days apart. ✨ #satellites⚡#forests⚡#monitoring⚡#geography⚡#nature⚡#earth 👉subscribe Amazing Geography 👉more Channels ​

12
ПретходнаСтраница 1 од 2Следна