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

Резултати

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

Пребарај: #scotus

当前筛选 #scotus清除筛选
Senator Ted Cruz

@SenTedCruz · Post #1273 · 24.06.2021 г., 19:00

🔻 Senate Judiciary Democrats voted against my amendment to prevent the packing of the Supreme Court. The Democrats’ radical agenda is clear: they want to pack #SCOTUS with liberal activist judges. https://t.co/92JJFFVaD4 June 24, 2021 at 11:25PM via Twitter @SenTedCruz

Hashtags

America 🇺🇸 News & Politics

@America · Post #10471 · 09.04.2026 г., 13:09

⚖️🇺🇸SUPREME COURT DEMANDS 27 MILLION FOR JUSTICE PROTECTION 🔹 Court requests twenty six point eight million for justice residential protection amid violence surge 💰 🔹 New permanent police force replaces costly US Marshals with twenty four seven home coverage 🏠 🔹 Threat unit expands with eight analysts conducting family risk assessments 🕵️ 🔹 Security upgrades include cybersecurity firewalls as political assassinations increase nationwide 💻 🔹 Total budget jumps to one hundred seventy seven million from one fifty three million last year 📈 When democracy is under attack even highest court needs bodyguards 🛡️⚖️ #USNews#SCOTUS @america

America 🇺🇸 News & Politics

@America · Post #10478 · 11.04.2026 г., 13:07

⚖️👴SUPREME COURT RETIREMENT POLITICS: THOMAS AND ALITO UNDER PRESSURE 🔹 Justice Clarence Thomas (77) and Samuel Alito (76) are oldest members facing retirement speculation 🏛️📅 🔹 Political window narrows before potential Democratic Senate control in 2027 midterm elections ⏰🗳️ 🔹 Alito recently hospitalized, wife reportedly wants retirement, while Thomas signals staying until 2034 🏥📝 🔹 Trump could nominate fifth justice total — unmatched presidential impact since Eisenhower era 🇺🇸👨‍⚖️ Strategic retirements could lock in conservative 6-3 majority for decades with younger appointees in their 40s-50s ⚡🔒 #SCOTUS#politics @america

America 🇺🇸 News & Politics

@America · Post #10289 · 28.02.2026 г., 09:42

⚖️🇺🇸 SUPREME COURT STRIKES DOWN TRUMP'S TARIFFS IN 6-3 RULING 🔹 Court rules Trump exceeded presidential authority using IEEPA for trade tariffs 🏛️ 🔹 White House scrambles to announce new 15% replacement tariffs — EU freezes deal legislation 🌍 🔹 Foreign governments thrown into chaos as existing trade deals face uncertainty 📉 The biggest check on executive power in years — and markets are watching closely 👀🔥 #USNews#politics#SCOTUS @america

America 🇺🇸 News & Politics

@America · Post #10614 · 06.05.2026 г., 16:08

⚖️🇺🇸SUPREME COURT BOMBSHELL — NATIONWIDE ABORTION PILL ACCESS RESTORED, CONSERVATIVES RAGE 🔹 SCOTUS temporarily overrules lower court restrictions on mifepristone — most widely used abortion medication 💊 🔹 Millions of American women regain access after weeks of legal chaos and pharmacy confusion nationwide 📋 🔹 Conservative justices dissent as reproductive rights advocates claim major victory in post-Roe landscape ⚖️ 🔹 Plan C self-managed abortion movement surges as women stockpile pills amid ongoing court battles 📦 American healthcare system remains battlefield as states prepare counter-legislation 🔥⚡ #SCOTUS#healthcare @america

America 🇺🇸 News & Politics

@America · Post #10535 · 21.04.2026 г., 13:08

💸🇺🇸TRUMP FORCED TO REFUND $166 BILLION IN TARIFFS AFTER SUPREME COURT DEFEAT 🔹 Supreme Court ruled Trump's global tariffs under IEEPA illegal in 6-3 decision February 2026 ⚖️ 🔹 Refund system launched April 20 covering 330,000 importers across 53 million entries 📋 🔹 FedEx, Costco, Toyota, Nintendo among major companies filing for refunds plus interest 🏢 🔹 Businesses must apply through CBP's new system, refunds expected in 30-90 days 💰 🔹 Trump imposed new 10% tariffs under different law to replace struck-down duties 🔄 From "making America wealthy again" to paying it all back with interest — biggest trade policy reversal ever! 😬💸 #TariffRefunds#SCOTUS @america

America 🇺🇸 News & Politics

@America · Post #10444 · 01.04.2026 г., 13:04

🏛️🇺🇸SCOTUS WEIGHS TRUMP'S BIRTHRIGHT CITIZENSHIP BAN 🔹 Supreme Court hears oral arguments on Trump's executive order to end automatic citizenship for babies born on US soil ⚖️ 🔹 Liberal justices blast the move as unconstitutional, conservatives split on 14th Amendment interpretation 📜 🔹 Over 400,000 babies born to undocumented parents each year could lose citizenship rights 👶 🔹 Immigration attorneys file emergency injunctions in federal courts nationwide 📋 🔹 Ruling expected by June 2026, could reshape American immigration law forever 📅 The Constitution vs. Trump's vision of America 😬🔥 #USNews#SCOTUS#Trump#immigration @america

IELTS|Newspapers & Magazines|English

@emagzinewspars · Post #9275 · 04.10.2025 г., 15:54

#The_Economist🇬🇧📕[PDF]⬇️ 4 #October2025 #Weekly_Magazines For learning, for free(dom). @backupofmagazines The Economist’s new cover unpacks how Putin tests NATO resolve via cyber threats, hybrid warfare, and disinformation. Meanwhile, America wrestles with rising #DrugPrices and legal debates in the #SCOTUS. Across 80+ pages: China’s crypto crime, #ByteDance pivots, Gaza diplomacy, #AI-driven taxis, and Europe’s innovation bottlenecks. Plus, red-light skincare science and TikTok’s future beyond U.S. distraction. A global scan of risk, tech, and politics.

America 🇺🇸 News & Politics

@America · Post #10629 · 09.05.2026 г., 00:04

⚖️💀SUPREME COURT OVERTURNS CALIFORNIA DEATH PENALTY MORATORIUM 🔹 6-3 conservative majority ruling allows states to resume executions — overturns 2019 Newsom executive order moratorium 📋 🔹 Texas immediately schedules 12 executions beginning June 2026 — California must decide on 700+ death row inmates 🏛️ 🔹 Justice Roberts writes majority opinion citing state sovereignty over criminal justice matters — liberal justices dissent strongly ⚖️ 🔹 Anti-death penalty advocates call it "darkest day for human rights" — governors in 15 states reviewing policies 📊 America's criminal justice system faces seismic shift as executions restart nationwide 🔥 #SCOTUS#deathpenalty#criminal @america

America 🇺🇸 News & Politics

@America · Post #10396 · 18.03.2026 г., 13:11

⚖️🇺🇸SUPREME COURT SIDES WITH PARENTS ON TRANS STUDENTS 🔹 Court blocks California schools from hiding students' gender transitions from parents 🏫 🔹 Schools must follow parental instructions on names and pronouns, major victory for families 📝 🔹 Ruling overturns progressive district policies in transgender student cases 🏳️‍⚧️ 🔹 Three Democratic justices dissent, showing deep ideological split on parental rights ⚖️ 🔹 Decision could impact similar policies nationwide as culture wars intensify 🇺🇸 California progressives are furious. Is this the new normal for parental control? 🔥📚 #USNews#SCOTUS#parents#transgender @america

America 🇺🇸 News & Politics

@America · Post #10351 · 08.03.2026 г., 05:34

👨‍👩‍👧‍👦📜SUPREME COURT BLOCKS CALIFORNIA FROM HIDING TRANS KIDS 🔹 Major Ruling: The Supreme Court has struck down California's controversial "Safety Act," which banned schools from forcing teachers to "out" trans kids to parents. 🛑🏳️‍⚧️ 🔹 Parental Rights Win: Validating the concerns of conservative parents nationwide, the court affirmed that schools cannot keep secrets from families about a child's identity. 🏆👨‍👩‍👧‍👦 The battle for the classroom continues. For now, parental notification is the law of the land. California loses again. 🏛️ #SCOTUS#TransRights#ParentalRights#California#Education#Newsom

12
ПретходнаСтраница 1 од 2Следна