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

Резултати

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

Пребарај: #commerzbank

当前筛选 #commerzbank清除筛选
Libertà è ragione

@libertaeragione · Post #4246 · 24.09.2024 г., 11:07

#Italia#Germania#USA È scoppiato in questi giorni il caso #Unicredit: la banca ha infatti annunciato che la sua quota in #Commerzbank (importante banca tedesca) è ora al 21%, grazie all'acquisto di uno strumento finanziario che rappresenta circa l'11,5%, sommato alla partecipazione del 9,5% precedentemente acquisita in due tranche: metà sul mercato e l’altra metà nel corso di un’asta indetta dal Governo tedesco, che, a suo dire, era inconsapevole delle volontà della banca italiana. UniCredit ha chiesto alla #BCE il permesso di arrivare fino al 29,9%, mantenendosi al di sotto del limite che imporrebbe un'offerta pubblica di acquisto obbligatoria. La reazione del cancelliere tedesco Olaf #Scholz (#SPD|S&D) è stata dura: "Le acquisizioni ostili non sono una buona cosa". Anche i sindacati tedeschi si dichiarano sul piede di guerra per i tagli temuti. La risposta del Ministro degli Esteri Antonio #Tajani (#FI|EPP) è arrivata a margine dei lavori dell'Assemblea #ONU a #NYC: "In Europa c'è libero mercato, non capisco perché quando qualcuno viene ad acquistare in Italia si dice che siamo in un sistema europeo moderno del mercato unico, se poi un italiano acquista fuori non è più nel mercato unico. Sono certamente iniziative di privati queste, ma legittime, quindi non comprendo perché dovrebbe essere un atto ostile quella di un'impresa italiana che acquista nel mercato europeo. Poi ci sono le norme dell'Unione bancaria, ci sono le norme europee, quindi mi pare che Unicredit le abbia rispettate". @OsservatorioItaliano

Savino Balzano

@savinobalzano · Post #756 · 24.09.2024 г., 16:59

https://x.com/SavinoBalzano/status/1838621376539664486?t=8gFSY8t9sWXZ4AQlOQa87g&s=19 E qui casca l'asino! Il #Cancelliere tedesco #Scholz si è incazzato: #Unicredit ostile su #Commerzbank. La vicenda dimostra la reale natura di un'#UE fatta per consentire ai più forti di depredare i più deboli: il gioco è ben accetto quando è la #Germania (o la #Francia) a spolparci; no, quando è l'#Italia ad alzare la capoccia. Insomma, tutti felici e contenti se il nostro Paese fa la parte del supermarket. È per questo che è stato pensato il mercato unico ed è fisiologico che restino spaesati da questo evento assai assai raro. Avremmo dovuto imbufalirci noi, tante e tante volte e non lo abbiamo fatto: stendiamo un velo pietoso. Sia chiaro, quella di #OlafScholz è solo una pagliacciata: il vento sta cambiando, se la sta facendo sotto, e prova disperatamente a mostrare qualche muscolo. La verità è che il patriottismo non sanno nemmeno dove sta di casa: è andato a picco col sabotaggio del #Nordstream. La mia a #5Notizie, #RadioCusanoCampus.

Crypto M - Crypto News

@CryptoM · Post #64541 · 09.04.2026 г., 07:05

🚀 U.S. Dollar Index Remains Stable Amid Middle East Tensions The U.S. Dollar Index (DXY) maintained stability on April 9, despite ongoing uncertainties surrounding the conflict in Iran. According to BlockBeats, the situation remains tense following a two-week ceasefire agreement between the United States and Iran. Iran continues to launch missiles and drones towards Arab nations in the Persian Gulf, while Israel has targeted Hezbollah militants in Lebanon. Iran has also informed mediators of its intention to limit the number of ships passing through the Strait of Hormuz and impose transit fees. Analysts from Commerzbank have expressed concerns, suggesting that the ceasefire may be a fragile pause in the conflict, as it inherently implies further negotiations. #USDollarIndex#MiddleEastTensions#IranConflict#DXY#Ceasefire#StraitOfHormuz#PersianGulf#Israel#Hezbollah#Commerzbank#TransitFees#GlobalUncertainty