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

Резултати

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

Пребарај: #buyrating

当前筛选 #buyrating清除筛选
Crypto M - Crypto News

@CryptoM · Post #65143 · 11.04.2026 г., 12:05

🚀 Wall Street Analysts Predict MSTR Stock to Double This Year Most Wall Street analysts anticipate that the stock price of Michael Saylor's company, MSTR, will more than double this year. According to Odaily, the majority of analysts maintain a buy rating, describing it as one of the most undervalued companies globally. #WallStreet#MSTR#StockPrediction#MichaelSaylor#BuyRating#UndervaluedCompanies

Crypto M - Crypto News

@CryptoM · Post #65130 · 11.04.2026 г., 09:03

🚀 TD Cowen Analyst Lowers Target Price for MicroStrategy TD Cowen analyst Lance Vitanza has revised the target price for Bitcoin reserve company MicroStrategy (MSTR) from $440 to $350, while maintaining a buy rating. According to Odaily, this adjustment reflects the analyst's updated assessment of the company's financial outlook. #TDCowen#Analyst#TargetPrice#MicroStrategy#Bitcoin#MSTR#FinancialOutlook#BuyRating#BTC

Crypto M - Crypto News

@CryptoM · Post #64767 · 09.04.2026 г., 20:52

🚀 Analyst Lance Vitanza Initiates Buy Ratings on Three Treasury Companies Lance Vitanza from TD Cowen has initiated coverage on Nakamoto, SharpLink Gaming, and Strive with Buy ratings. According to NS3.AI, Vitanza has set price targets of $1, $16, and $26 for these companies, respectively. He suggests that these treasury firms have the potential to outperform spot crypto exchange-traded products, provided that cryptocurrency prices recover and the companies continue to increase their token holdings per share. #LanceVitanza#TD Cowen #Nakamoto#SharpLinkGaming#Strive#BuyRating#TreasuryCompanies#Crypto#TokenHoldings#PriceTargets#BTC

Crypto M - Crypto News

@CryptoM · Post #65373 · 13.04.2026 г., 02:56

🚀 Daiwa Raises Gu Ming's Target Price to HKD 36 On April 13, according to Jin10, Daiwa released a research report raising the target price of Gu Ming (01364.HK) from HKD 35 to HKD 36, maintaining a 'buy' rating. This corresponds to a forecasted price-to-earnings ratio of 22 times for 2026. Daiwa noted that Gu Ming's takeaway proportion has decreased from a peak of 60% in the third quarter of last year to below 50%. The management expects this trend to continue, aiming to improve franchisee profitability through initiatives such as dine-in promotions, extending morning business hours, and increasing coffee sales. The firm has also raised its earnings per share forecast for Gu Ming from 2026 to 2028 by 6% to 12%. #Daiwa#GuMing#TargetPrice#HKD36#BuyRating#FranchiseeProfitability#EarningsForecast#TakeawayProportion#CoffeeSales#MorningBusinessHours