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

Пребарај: #gambela

当前筛选 #gambela清除筛选
Addis Standard

@addisstandardeng · Post #21268 · 01.02.2026 г., 09:18

News: #UK bans all travels to #Tigray, #Amhara, and #Gambela regions, issues sweeping warnings across Ethiopia The British government has significantly expanded its travel warnings for #Ethiopia, banning all travels to Tigray, Amhara and Gambella regions and advising against travels to several regions and large border areas owing to deteriorating security conditions. In its latest advisory, the UK Foreign, Commonwealth & Development Office (#FCDO) stated: UK nationals are advised against all travel to Tigray region, where recent reports show militarized tensions in various places. UK’s travel warning also bans all travels to Amhara region, where a war between government and the Fano armed groups remained active since it first broke in 2023; and Gambela region, where renewed clashes saw scored killed and schools shuttered. The advisory also extends to all areas within 10 kilometers of Ethiopia’s border with #Eritrea, and within 20 kilometers of the …. Read more: https://addisstandard.com/?p=54877

Addis Standard

@addisstandardeng · Post #21303 · 04.02.2026 г., 09:18

News: #Australia issues ‘do not travel’ advisory for #Tigray, #Amhara, and other regions in #Ethiopia The Australian government has issued a “do not travel” advisory for Ethiopia’s Tigray regional state, warning that the security situation could deteriorate rapidly with little or no warning, according to its latest update on the Smartraveller travel advisory platform. In the update, Australian authorities urged their citizens currently in Tigray to leave when it is safe to do so using commercial means, noting that Australia’s ability to provide consular assistance in the region remains “extremely limited.” Travelers were also advised to follow local authorities’ instructions and to shelter indoors in the event of civil unrest or armed conflict. Beyond Tigray, Australia continues to advise against all travel to the Amhara, #Benishangul-Gumuz, and #Gambela regional states, as well as border areas with #Eritrea, #Sudan, #South_Sudan, #Kenya, and #Somalia,.... Read more: https://addisstandard.com/?p=54924

Ethio-Veterinary- vacancy

@vetjobethiopia · Post #44 · 07.12.2023 г., 14:50

Area Sales Manager #ethiochicken_ethiopia #business #Bule | #Ambo | #Gambela | #Ginir | #Hosaena | #Yirgachefe | #Sheno BSc Degree in Animal Science, Veterinary field of study Duties & Responsibilities: - Develop specific plans to ensure sales growth agent appointment in the territory - Map how to achieve sales volume through prioritizing to make big achievement with minimum effort and shorter time Quanitity Required: 20 Minimum Years Of Experience: #0_years Deadline: December 16, 2023 How To Apply: Submit your applications (Cover Letter) including a detailed CV via email: [email protected] N.B: Please title your application with the subject line: - " Area Sales Manager" and Specify the area you are applying for