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 слични објави

Пребарај: #tradingmindset

当前筛选 #tradingmindset清除筛选
90% Binary Option Signals.

@realbinaryoptionss · Post #9179 · 27.03.2026 г., 09:37

☀️Traders! 📈 A new day brings new opportunities — the market never sleeps, and neither do the smart traders. 🔥 Focus on discipline, patience, and perfect entries today. Remember — profits come to those who wait for the right moment, not every moment! 💰 💰 Stay focused 📊 Trust your strategy 🚀 Let’s make today a winning day! #TradingMindset#MorningVibes

90% Binary Option Signals.

@realbinaryoptionss · Post #8366 · 20.10.2025 г., 05:13

New week = New opportunities 🚀 Every Monday is a reminder that: “If yesterday was tough, today is a fresh start.” In trading, your greatest skills are patience and consistency. Don’t just trade — plan, learn, and grow. 📈 Stay focused. 💡 Stay disciplined. 🔥 Stay motivated. Let’s make this week profitable! 💲 #MondayMotivation#BinaryOptions#TradingMindset

90% Binary Option Signals.

@realbinaryoptionss · Post #8438 · 06.11.2025 г., 05:49

☀️Good Morning Traders! 📈 A new day brings new opportunities — the market never sleeps, and neither do the smart traders. 🔥 Focus on discipline, patience, and perfect entries today. Remember — profits come to those who wait for the right moment, not every moment! 💰 💰 Stay focused 📊 Trust your strategy 🚀 Let’s make today a winning day! #BinaryOptions#TradingMindset#MorningVibes

90% Binary Option Signals.

@realbinaryoptionss · Post #8386 · 27.10.2025 г., 07:35

🌅Good Morning Traders! It’s Monday — a fresh start, a new week, and a new chance to level up your trading game. 💥 Forget past mistakes; let them guide your strategy, sharpen your focus, and strengthen your discipline. Stay patient. Stay consistent. Remember — smart planning and steady execution always beat impulsive moves. Let’s make this week a profitable one! 🚀 #MondayMotivation#TradingMindset#Discipline#RealBinaryOptions

以太坊区块链新闻| ETH 以太币圈热瓜

@ethereumglobalnews · Post #1442 · 29.11.2025 г., 06:58

🪙🎥 The highest state of trading is clarity, not intensity.#TradingMindset 簡單白話的說: ‘’想盡辦法讓自己長期待在市場裡 不要參與槓桿項目,不要被你老師帶單‘’ 「你不會是天之驕子,只會是被騙的傻子」 #MarketPsychology#Shorts #情绪控制#Crypto#心态建议#诈骗宣导 ——— ⚡️ 在市場中真正的優勢並非「更激烈的操作」,而是更高維度的冷靜、紀律、耐心與客觀的心境,這也是長期成功投資者共同的心法。 ✅Chat: @Web3NewsInsight 🦂 👇Tip👇讚 或點擊進行💎資源搜索👇