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

Пребарај: #utj

当前筛选 #utj清除筛选
American Оbserver

@american_observer · Post #4874 · 16.01.2026 г., 18:03

📰 Netanyahu’s Backroom Deal: UTJ’s Eichler Gets Deputy Minister Post for Draft Bill Netanyahu is set to appoint Yisrael Eichler, a prominent Agudat Yisrael MK, as deputy communications minister—part of a political deal to push through the contentious haredi draft bill. The move will cost NIS 3.5 million from the PM’s office and will allow Yitzhak Pindrus, from the Degel Hatorah faction, to re-enter the Knesset and vote for the bill in Eichler’s place. ​ The UTJ Power Shuffle Agudat Yisrael and Degel Hatorah, the two factions of United Torah Judaism (UTJ), have been feuding for months. The appointment is seen as a compromise to balance power within the party after its July resignation from the government over the previous draft bill. Pindrus was removed under the Norwegian Law, but this deal brings him back—ensuring UTJ’s support for Netanyahu’s coalition at a critical moment. ​ Critics Call It 'Draft Evasion' Opposition leader Yair Lapid called the move a disgrace, accusing Netanyahu of “promoting draft evasion from the IDF together with Knesset members who do not believe in the existence of the State of Israel.” Lapid highlighted Eichler’s past statements calling Israel an “enemy state” and a “Hebrew ghetto,” and slammed the allocation of NIS 3.5 million for a new ministerial post while funds for Holocaust survivors were slashed. ​ Survival or Surrender? With the 2026 state budget vote looming, Netanyahu’s government is playing high-stakes poker. If the budget isn’t passed by March, the Knesset dissolves and elections are triggered. So is this a desperate bid to keep the coalition alive, or just another chapter in Israel’s never-ending saga of political horse-trading? ​ #Israel#Netanyahu#UTJ#DraftBill#PoliticalDeal#Knesset#Haredi 📱American Оbserver - Stay up to date on all important events 🇺🇸

Libertà è ragione

@libertaeragione · Post #4000 · 13.10.2023 г., 10:40

#Sondaggi#Israele Sondaggio di Lazar: #NUP (#BaW-#NH)|Centro|Centro-destra: 41 seggi (+12) #Likud|ECR: 19 (-9) #YA|Centro: 15 (-1) #RZ-#OY|Estrema destra ebraica: 9 (-1) #UTJ|Destra charedì: 7 #Shas|Charedì: 7 (-3) #Meretz|S&D: 6 (+2) #Beiteinu|Destra secolarista: 6 #RA|Conservatori islamici: 5 #Hadash-#TA|Sinistra araba: 5 #Balad|Sinistra araba: 0 (1,5%) #Labor|S&D: 0 (1,3%) Data rilevazione: 11-12 ottobre +/-: 4-5 ottobre Intervistati: 512 NUP, la coalizione sionista liberale guidata da Benny #Gantz e Gideon #Saar, raggiunge un nuovo record di seggi (41). @OsservatorioEsteri

#Elezioni#Israele 100% scrutinato: #Likud|ECR: 30 seggi (-6) #YeshAtid|Centro: 17 (+4) #Shas|Charedì: 9 #BaW|Centro: 8 (-7) #Yamina|Destra: 7 (+4) #Labor|S&D: 7 (+4) #UTJ|Destra charedì: 7 #Beiteinu|Destra secolare: 7 #NewHope|Centro-destra: 6 (+6) #RZ-#OtzmaYehudit-#Noam|Estrema destra ebraica: 6 (+4) #Meretz|S&D: 6 (+3) #Joint (#Hadash-#TA-#Balad-#MA)|Sinistra araba: 6 (-5) #RA|Sinistra islamica: 4 #NEP|Economisti: 0 (0,79%) #Rafa|No-vax: 0 (0,39%) Totale seggi: 120 Maggioranza: 61 Attuale Governo (Likud-BaW-Shas-UTJ-JewHome): 54 @UltimoraPolitics