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

Резултати

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

Пребарај: #aviation

当前筛选 #aviation清除筛选
Indian Development News 🇮🇳

@developmentnewsindia · Post #44442 · 05.05.2026 г., 09:39

Breaking: A Boeing 737 plane that plummeted into a Chinese hillside in 2022, killing all 132 people on board, had its fuel supply cut mid-flight, according to newly released data by the US National Transportation Safety Board (NTSB). Findings by the NTSB say that the fuel switches on both engines of the China Eastern flight were moved to the "cut-off" position while it was at a cruising altitude of 8,839m (29,000ft) — exactly like the AI171 Air India crash in Gujarat last year. China has yet to release a final report on the incident, citing national security concerns. #Aviation BBC Article

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #44321 · 02.05.2026 г., 08:30

GPS Renewables started construction on India's first Ethanol-to-Jet (ETJ) Sustainable Aviation Fuel (SAF) plant in Pudimadaka, Andhra Pradesh, under an NTPC Green Energy EPC contract. Using Lummus Technology and Xytel India's engineering, the facility at NTPC's Green Hydrogen Hub will produce 1,800 tonnes per annum of SAF and renewable diesel. The process converts CO2-derived ethanol via ethylene conversion, oligomerisation, and hydroprocessing. This project advances India's sustainable aviation fuel scaling and transport sector decarbonization goals. Source #Aviation

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #44289 · 01.05.2026 г., 10:50

India is redefining the rules of the game with its upcoming airport privatisation plans, aiming to curb monopolistic tendencies in the aviation sector. The govt is laying down new ground rules to promote a healthy competitive environment. Source #Aviation

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #44221 · 30.04.2026 г., 06:28

IndiGo resumes direct India–China flights with Delhi–Guangzhou service; first landing on Apr 28 restores connectivity after ~4–5 year gap. Airline operates daily routes using A320 aircraft, expanding to Shanghai and Kolkata routes with ~21 weekly departures. #Aviation https://t.co/3nGRpvMboR

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #44119 · 27.04.2026 г., 08:25

🛠️ AIESL plans to expand the Nagpur aviation maintenance facility into a major MRO hub. 📍 The company is seeking EASA certification to service Airbus aircraft for global airlines. ✈️ The site has already completed 240+ maintenance checks on Boeing and Airbus fleets. #Aviation https://t.co/GosIlxNf56

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #43974 · 23.04.2026 г., 11:30

Embassy of France in India "With effect from 10 April 2026, Indian nationals possessing an ordinary passport are no longer required to hold an airport transit visa when passing through the international zone of airports located on French territory. This measure applies to passengers remaining in the international zone during a layover at a French airport en route to a third country." #Aviation

Hashtags

Indian Development News 🇮🇳

@developmentnewsindia · Post #43593 · 14.04.2026 г., 14:15

✈️ India's newest regional airline Star Air will launch 38 weekly flights to Mundra from 25 April. 🌐 Direct links to Mumbai, Hindon, Goa (Mopa) & Surat plus one-stop routes. 🪑 Adds 4,100+ weekly seats, boosting regional connectivity. #Aviation https://t.co/0Ys3hXULvs

Hashtags

Лёгкое небо

@legkoenebo · Post #3985 · 01.06.2025 г., 20:59

Кто знает, что это такое и для чего используется? ⏺И вопрос для профи, считайте показания этой «штуки» Лёгкое небо | Донат #aviation

Hashtags

123•••5•••10•••15•••20•••25•••30•••35•••40•••45•••50•••55•••5758
ПретходнаСтраница 1 од 58Следна