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

Пребарај: #oas

当前筛选 #oas清除筛选
Russian Consulate in Cape Town

@rusconct · Post #2315 · 08.03.2025 г., 06:02

🎙 Foreign Ministry Spokeswoman Maria Zakharova’sanswer to a media question about Russia’s stance with respect to the Organisation of American States ❓Question: How would you characterise the current stage of Russia’s relations with the OAS? 💬Maria Zakharova: As is well known, the Russian Federation obtained the status of Permanent Observer to the Organisation of American States in 1992 and has developed constructive relations with this association of Western Hemisphere states over three decades. Cooperation has been successfully advanced both with the #OAS itself and its specialised agencies, including the Inter-American Drug Abuse Control Commission (CICAD), the Inter-American Committee against Terrorism (CICTE), and others. We note that a number of leading Latin American countries did not support the OAS Permanent Council’s April 2022 decision to suspend Russia’s observer status. At the same time, practical collaboration with regional states has continued to develop dynamically at all levels. The Russian Side remains open to restoring full-fledged engagement with the OAS, as evidenced by the appointment of Russia’s new Ambassador to the United States, Alexander Darchiev, to concurrently serve as Permanent Observer to the OAS.

Hashtags

Alex Kowalski | Trade

@kowalskitrade · Post #9 · 06.05.2024 г., 15:01

📣Top 7 unlocks for the week Major unlocks of tokens from May 6 to May 12: ➡️#APT for $102.91 million (2.64% of capitalization, 12.05) ➡️#ICP for $43.02 million (0.7% of capitalization, 11.05) ➡️#KARATE for $29.66 million (❗️199% of capitalization, 12.05) ➡️#MASA for $27.80 million (❗️160.1% of capitalization, 11.05) ➡️#GMT for $23.68 million (5.39% of capitalization, 9.05) ➡️#DAO for $13.25 million (5.84% of capitalization, 9.05) ➡️#OAS for $10.17 million (8.82% of capitalization, 12.05).

GitHub Trends

@githubtrending · Post #14911 · 03.07.2025 г., 15:30

#javascript#hacktoberfest#oas#open_source#openapi#openapi_specification#openapi3#openapi31#rest#rest_api#swagger#swagger_api#swagger_js#swagger_oss#swagger_ui Swagger UI is a tool that helps developers and users interact with APIs. It creates a visual interface from OpenAPI specifications, making it easy to understand and use APIs without needing to know the underlying code. This tool benefits users by providing clear documentation and allowing them to test API methods directly from the interface. It also supports collaboration and compliance with the latest OpenAPI standards, making it easier to develop and consume APIs efficiently[1][3][5]. https://github.com/swagger-api/swagger-ui