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

Резултати

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

Пребарај: #mergers

当前筛选 #mergers清除筛选
Universe Mysteries 🪐

@cosmomyst · Post #536 · 03.12.2025 г., 22:21

🪐 Some of the most unusual stars in the universe are "blue stragglers," like those found in the globular cluster M30. Blue stragglers appear younger and hotter than neighboring stars in their ancient cluster, likely because they formed when two stars merged or stole material from a companion—making them stand out as apparent "youngsters" among a population of stellar elders. ✨ #stars⚡#mergers⚡#clusters⚡#nasa⚡#galaxy⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #667 · 08.02.2026 г., 12:21

🪐 Not all galaxies fit the classic spiral or oval shapes—take the galaxy LEDA 074886, located about 70 million light-years away, which stunned astronomers with its rare rectangular structure. Unlike the familiar swirls or smooth ellipses, LEDA 074886’s boxy outline is thought to be the result of a merger between two smaller galaxies, sculpting a cosmic shape almost never seen in the universe. ✨ #galaxies⚡#mergers⚡#shapes⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #457 · 25.10.2025 г., 22:21

🪐 The galaxy NGC 7252, also known as the "Atoms-for-Peace" galaxy, displays a wild, tangled structure with long, luminous tidal tails created by the collision of two spiral galaxies. These sweeping arms of stars and gas stretch far from the core, forming loops and shells that resemble atomic orbital patterns, making NGC 7252 one of the most striking examples of how galactic mergers can sculpt galaxies into truly unusual shapes. ✨ #galaxies⚡#mergers⚡#peculiarity⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #63 · 02.08.2025 г., 13:11

🪐 In the constellation Dorado, the massive galaxy NGC 1316 bears the scars of cosmic collisions—its shell-like structures and tangled lanes of dust betray a history of devouring smaller galaxies. Radio observations have revealed that this turbulent giant also hosts powerful jets and lobes fueled by a hidden supermassive black hole at its core, making NGC 1316 a remarkable blend of chaos and creation in the southern sky. ✨ #galaxy⚡#mergers⚡#radioastronomy⚡#blackhole⚡#nasa⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries

Venture Village Wall 🦄

@venturevillagewall · Post #3876 · 14.01.2025 г., 19:00

Deribit Attracts Potential Acquirers Attention Crypto exchange Deribit is drawing interest from potential acquirers, signaling a shift in the M&A landscape for crypto platforms. This comes amid regulatory scrutiny and evolving market conditions. For more details, check the full article here: BBG. #Crypto#Deribit#Investment#Acquisition#Exchange#Mergers#MarketTrends#Finance#Regulation#Tokens#Trading#DigitalAssets#GlobalFinance#VentureCapital#Tech#Cryptocurrency

Venture Village Wall 🦄

@venturevillagewall · Post #3442 · 19.12.2024 г., 10:59

Investors Eye Russian M&A Boom Investment activity in Russia is on the rise, with a surge in mergers and acquisitions along with simplified IPO processes. Founders are encouraged to connect with key strategists and investors to navigate these opportunities effectively. Notably, investor Alexander Radionov, owner of M&A boutique and foodtech companies Broniboy and Bumеrang, shares insights on capital growth and successful exits on his channel. He monitors promising projects and organizes events for founders to facilitate company sales ripe for exit. Explore his channel for valuable resources on capitalization growth and exit strategies. #Investment#M&A #IPO#Russia#BusinessGrowth#ExitStrategies#FoodTech#AlexanderRadionov#Broniboy#Bumeеrang#Capitalization#InvestorConnections#Mergers#Acquisitions#PrivateEquity#Entrepreneurship#Growth#Success#BusinessSales#MarketTrends