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

Резултати

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

Пребарај: #safety

当前筛选 #safety清除筛选
Bali News

@balinews · Post #537 · 05.12.2025 г., 15:00

📰 Tragedy at Sangeh Monkey Forest 🐒 A large old nutmeg tree fell during a severe storm at the Pura Bukit Sari temple within Sangeh Monkey Forest. What happened: ▪️ The tree crushed a bale gong pavilion where staff were sheltering. ▪️ A 51-year-old guide, Ida Bagus Nyoman Suamba, died. ▪️ A second staff member was injured. ▪️ Damage is estimated at ~1 billion IDR. 😔 An eyewitness reported leaving the pavilion with a colleague moments before the collapse, which saved them. A recurring danger: Last year, a similar incident in Ubud's Monkey Forest killed two tourists. Safety reminder for rainy season: ✅ Do NOT shelter under old tall trees during storms. ✅ Be aware of your surroundings. ✅ Heed staff warnings. #safety#accidents@BaliNews

Kursiv Uzbekistan (Eng)

@kursivuzeng · Post #2704 · 04.03.2026 г., 11:00

⚖️ Uzbekistan Considers Life Sentences for Child Sexual Offenders 🚨 Uzbekistan is proposing tougher penalties for child sexual offences, including the possibility of life imprisonment for convicted offenders. The measures were presented to President Shavkat Mirziyoyev during a meeting on protecting the rights of women and children. 📜 Authorities also suggest preventing convicted offenders from being transferred to lower-security prisons and shifting investigations of certain sexual crimes from police to the prosecutor’s office. 👩‍⚖️ Under the proposals, only specially trained lawyers, investigators and judges would handle cases involving violence against women and children, alongside stricter penalties for sexual harassment. 📱 To better protect women with restraining orders, officials propose installing an “SOS” emergency application on their phones to quickly request help. #Safety#Security

Kursiv Uzbekistan (Eng)

@kursivuzeng · Post #2701 · 04.03.2026 г., 06:03

🚨 Pakistan and Afghan Forces Clash Along Border, 42 Civilians Killed ⚔️ Pakistani and Afghan forces exchanged fire at several points along their 2,600-km border, with the United Nations mission in Afghanistan reporting at least 42 civilians killed and 104 wounded during six days of fighting. ✈️ Tensions escalated after Pakistan launched air strikes on Afghan cities last week. Islamabad said it targeted Bagram air base north of Kabul, claiming intelligence showed militants were using the site to support attacks on Pakistani forces. 🔥 Clashes have spread across the frontier, with Afghanistan saying Taliban fighters seized a Pakistani military post near Kandahar, while Pakistan reported fighting at more than two dozen locations and strikes on facilities in Jalalabad and Nangarhar. 🏠 The UN warned the violence has displaced around 16,400 households and disrupted humanitarian aid in areas already struggling after recent earthquakes, urging both sides to halt the fighting and prevent further escalation. #Safety#Security

Kursiv Uzbekistan (Eng)

@kursivuzeng · Post #2685 · 28.02.2026 г., 08:34

🕊 Uzbekistan Calls for Ceasefire After Afghanistan–Pakistan Border Clashes ⚠️ Uzbekistan expressed concern over escalating violence along the Afghanistan–Pakistan border, urging both sides to immediately cease fire and resolve disputes through peaceful, diplomatic means. 💥 Clashes began on February 26 after Pakistan accused Afghan forces of firing on its border posts, while Kabul said its actions were retaliation for Pakistani air strikes on February 22 targeting militant groups. ✈️ During the fighting, Pakistan reportedly struck Kabul, Kandahar, and other Afghan-controlled areas. Afghan officials later expressed openness to negotiations. 💀 Casualties reported include over 270 Taliban militants killed by Pakistan and 55 Pakistani deaths, according to Afghan authorities. 🕌 Pakistan claims the Afghan Taliban shelter Tehrik‑e‑Taliban Pakistan leaders, a charge Kabul denies. The U.S. has voiced support for Pakistan, citing Taliban failures to combat terrorism. #Safety#Security

Kursiv Uzbekistan (Eng)

@kursivuzeng · Post #2684 · 28.02.2026 г., 07:32

🚨 Israel Strikes Iran Amid Rising Nuclear Tensions 💥 Israel launched a pre-emptive strike on Iran, targeting nuclear and missile sites, escalating Middle East tensions and threatening diplomatic efforts. 🛡 Defence Minister Israel Katz said the operation aimed to “remove threats to the State of Israel,” and was planned months in coordination with the U.S. 🌆 Explosions were reported in Tehran, while sirens sounded across Israel warning of possible missile retaliation. Schools and workplaces were closed, and civilian air traffic halted. ⚠️ The strike follows a June air war and comes amid stalled negotiations over Iran’s nuclear programme. Israel demands full dismantling of nuclear infrastructure and limits on missiles. 💣 Iran warned it would respond to attacks and could target U.S. bases in the region. Western nations say Iran’s missile programme threatens stability, while Tehran denies seeking nuclear weapons. #Safety#Security

Anthropic предупреждает мир об угрозе кибербезопасности AI. А сам случайно теряет 3000 документов. Два дня назад исследователи из LayerX и Cambridge нашли открытый CMS Anthropic. Почти 3000 неопубликованных документов — в том числе черновик блога о новой модели Claude Mythos. Не один файл — вся база была публичной. Что теперь известно о Mythos: — Тир «Capybara» — выше Opus, крупнее, дороже — «Step change in performance» (значимое увеличение производительности), «most capable we've built» — «Far ahead of any other AI model in cyber capabilities» — Конкретных бенчмарков — ноль. Только формулировки. Может и «утечка» не случайная? Я плачу $200/мес за Opus 4.6, иногда 300. Мои 32 проекта — всё на Claude. Жду Митос — он будет следующим шагом. Ну а пока надо бы поручить опусу проверить безопасность в моих проектах) #ClaudeCode#safety

Bali News

@balinews · Post #505 · 07.10.2025 г., 09:05

📰Denpasar strengthens flood protection and reinforces riverbanks ℹ️ Following the September flood when the Badung River overflowed, Denpasar authorities are intensifying measures to protect the city from floods and inundations. A temporary dam made of sandbags has been set up at the mouth of the Ayung River to control water flow and safely restore damaged embankments. ⚠️ Meteorologists also warn of possible tidal flooding along Bali’s coasts from October 7 to 11. #weather#safety@BaliNews

Kursiv Uzbekistan (Eng)

@kursivuzeng · Post #2671 · 27.02.2026 г., 05:04

⚠️ Afghanistan and Pakistan Enter “Open War” After Air Strikes on Kabul 💥 Pakistan has carried out air strikes on Kabul and Kandahar following a sharp escalation in cross-border fighting. According to Al Jazeera, warplanes launched two raids on the Afghan capital early Friday and also struck a military base in Kandahar province. 🗣 Pakistani Defence Minister Khawaja Asif declared the situation an “open war” after Afghan Taliban forces reportedly launched retaliatory attacks on Pakistani military posts along the Durand Line. Taliban spokesperson Zabihullah Mujahid claimed dozens of Pakistani soldiers were killed and several captured. Islamabad rejected the claims, saying its counter-strikes hit Taliban headquarters and ammunition depots, killing at least 133 fighters. ⚔️ Militarily, Pakistan holds overwhelming conventional superiority with more than 600,000 active personnel, advanced air power and nuclear capability. The Taliban commands an estimated 100,000 to 150,000 fighters and lacks a functional air force or modern air defence systems, despite inheriting U.S. military equipment in 2021. 🌍 The crisis follows earlier Pakistani strikes in Nangarhar and Paktika targeting alleged TTP sanctuaries. Kabul said those attacks killed at least 18 civilians. A fragile ceasefire brokered in October has now collapsed, with both sides trading accusations over militant safe havens and cross-border attacks. #News#Safety#Security

Hulumarket - Buy & Sell Easily

@hulugramupdate · Post #284 · 16.02.2026 г., 14:51

⚠️ ከሁሉ ማርኬት እቃ ስናዝ ማድረግ ያለብን ጥንቃቄዎች 🚨 ✔️ የሻጩን ማንነት በደንብ ማጣራት ✔️ዋጋ ማጣራት (ስለረከሰ ብቻ ጥራታቸውን ሳናረጋግጥ መግዛት የለብንም) ✔️ከኣጭበርባሪዎች እራስዎን ይጠብቁ❗️ (እቃውን ከመረከብዎ በፊት ሂሳብ እይክፈሉ) ✔️ስለ የሚገዙት እቃ ግልፅ ማብራሪያ እንዳለው ማየት (ማንኛውንም እቃ ከመግዛትዎ በፊት የዕቃውን ዝርዝር መረጃ ማንበብ አይርሱ) 💥 📱PlayStore ላይ አፕሊኬሽኑን ያውርዱ ወይም 🌐hulumarket.com.et ን ይጎብኙ #Hulumarket#onlineshopping#safety

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40359 · 19.12.2025 г., 03:02

Before 1956, kids could get trapped inside refrigerators because doors only opened from outside. The Refrigerator Safety Act changed this, requiring doors to open easily from inside. UL tests make sure doors open with a push from inside. [Read more] @googlefactss 🧊🚪⚠️#Safety#ChildSafety

BadVolf

@badvolfnews · Post #2034 · 10.02.2025 г., 11:33

**Update:** In Krasnodar Krai, an unmanned aerial vehicle has crashed near a private house in Afipsky settlement, Seversky district. Governor Veniamin Kondratyev reported this incident through his Telegram channel, confirming no casualties and that emergency services are on-site assisting affected parties. Local authorities are working to restore property damaged by the crash. Meanwhile, another drone incident occurred nearby, with fragments hitting a residential complex known as 'Central.' A detailed room-by-room inspection is underway to assess any structural damage to buildings in the area. Since 2022, drones have been utilized in Russia's regional operations as part of their special military efforts against Ukraine. Ukraine has not officially confirmed involvement but provided support and information about potential increases in drone activity. Earlier reports indicated that Insta, a Finnish defense company, had developed a new kamikaze drone for Ukrainian use. #Safety#Incident

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