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

Резултати

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

Пребарај: #nasdaq100

当前筛选 #nasdaq100清除筛选
NEWS 鏈新聞-ABMedia

@abmedia_news · Post #24345 · 04.05.2026 г., 11:01

【💰 交易市場|為搶進 SpaceX、OpenAI 與 Anthropic IPO 熱潮,那斯達克與標普放寬標準】 #SpaceX#OpenAI#Nasdaq100 標普與那斯達克 5 月修改規則,縮短 SpaceX 等巨頭入選指數的等待期。 那斯達克增設快軌機制,市值前 40 名企業掛牌 15 天即可空降成為成分股。市場擔憂被動資金過早湧入,導致股價在定價前遭到嚴重扭曲。 📍閱讀全文: https://abmedia.io/nasdaq-sp500-listing-rules-relaxed 📍 訂閱鏈新聞頻道:https://linktr.ee/abmedia.io

Crypto M - Crypto News

@CryptoM · Post #65223 · 12.04.2026 г., 04:14

🚀 Sky Co-Founder Rune Faces Losses in Leveraged Oil and S&P 500 Positions Sky co-founder Rune's leveraged positions have recently experienced significant losses. According to Odaily, data from Hyperbot indicates that Rune's sevenfold leveraged short position on the Nasdaq 100 was closed 16 hours ago. Currently, he holds long positions valued at approximately $518,000, including a 20-fold leveraged long position in WTI crude oil futures and a sevenfold leveraged position in Brent oil. Additionally, Rune maintains a 20-fold leveraged short position on the S&P 500, valued at $159,000. At present, all of Rune's positions are in a loss state, with the total value dropping to around $678,000, reflecting a floating loss of approximately $61,000 and an investment return rate of -22.68%. Rune initially entered these positions last month when oil prices were rising, achieving a floating profit exceeding $1 million. However, recent fluctuations and declines in oil prices have turned these positions from profit to loss. #Sky#Rune#LeveragedTrading#OilFutures#SP500#Nasdaq100#FinancialLoss#WTICrude#BrentOil#Investing#SKY

Crypto M - Crypto News

@CryptoM · Post #64545 · 09.04.2026 г., 07:14

🚀 Whale Adjusts Investment Strategy Across Major Markets On April 9, a significant investor, known for substantial positions in three major markets, closed all long positions in WTICRUDE and BRENTOIL, according to BlockBeats. Previously, the combined holdings in these oils exceeded $14.1 million, resulting in a loss of over $3.9 million upon closure. Following this, the investor opened a short position in WTICRUDE at an average price of $92.3, with a current scale of $9.3 million and a liquidation price of $117.6. This adjustment has led to the following main positions across the three markets: In U.S. stocks, the investor holds long positions in the Nasdaq 100 and S&P 500, with a scale of $38.1 million and an unrealized profit of $430,000. In the cryptocurrency market, the investor maintains a long position in Bitcoin, with a scale of $12.05 million at an average price of $6,540, resulting in an unrealized profit of $30,000. In commodities, the investor's short position in WTI crude oil stands at $9.3 million, with an unrealized loss of $290,000. The address associated with these transactions is 0x8af700ba841f30e0a3fcb0ee4c4a9d223e1efa05. #Investment#MarketStrategy#WTICrude#BrentOil#USStocks#Nasdaq100#SP500#Bitcoin#Cryptocurrency#Commodities#Trading#Blockchain#BlockBeats#BTC

PRICE ACTION EXPERT

@priceactionexpert · Post #7905 · 23.11.2024 г., 08:14

https://x.com/priceactiongann/status/1830819785975955483 #nifty#geometry#banknifty New Course Book! ✅Market movements through the lens of advanced Geometric concepts. ✅Multidimensional and Spherical Time concepts of Trading with our upcoming course (book), ✅This innovative book dives deep into the concept of time-related trading, blending advanced geometric principles with practical markets Exploring Triangles, Squares, and Circles. ❤️🙏❤️ #stocks#stockmarket#gann#trading#time#gold#silver#xauusd#SPX500#DowJones#NASDAQ100

PRICE ACTION EXPERT

@priceactionexpert · Post #7723 · 03.09.2024 г., 04:08

https://x.com/priceactiongann/status/1830819785975955483 #nifty#geometry#banknifty New Course Book! ✅Market movements through the lens of advanced Geometric concepts. ✅Multidimensional and Spherical Time concepts of Trading with our upcoming course (book), ✅This innovative book dives deep into the concept of time-related trading, blending advanced geometric principles with practical markets Exploring Triangles, Squares, and Circles. ❤️🙏❤️ #stocks#stockmarket#gann#trading#time#gold#silver#xauusd#SPX500#DowJones#NASDAQ100