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

Резултати

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

Пребарај: #toulouse

当前筛选 #toulouse清除筛选
ÉTIENNE CHOUARD

@chouard · Post #623 · 09.06.2022 г., 16:08

💛 Découvrez les belles images de l'événement #giletsjaunes Convergence #RIC et MCP qui a été organisé il y a quelques jours à #Toulouse ! Livres, affiches, tracts, éducation populaire, panneau « Médias Français : qui possède quoi ? » etc. Un ÉNORME MERCI à Akina (membre et partenaire du MCP) avec le Front Médiatique & Inform’Action et aux autres bénévoles de Toulouse qui prennent le temps d’organiser des stands et de faire connaître TOUS les acteurs de la Convergence pour le RIC. N’hésitez pas à contacter le MCP pour vous aussi organiser de tels stands ! Voir les images : https://www.mouvement-constituant-populaire.fr/2022/actions/evenement-a-toulouse-pour-la-convergence-ric-avec-akina

AI match predictions

@ai_match_prediction · Post #11120 · 21.03.2026 г., 09:05

France Ligue 1🇫🇷 2026-03-21 16:00 UTC Toulouse vs. Lorient Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Toulouse 1:0 #Toulouse#Lorient 2026-03-21 18:00 UTC Auxerre vs. Stade Brestois 29 Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Auxerre 3:0 #Auxerre#StadeBrestois29 2026-03-21 20:05 UTC Nice vs. Paris Saint Germain Predicted outcome: Paris Saint Germain✅ Predicted score: 1:2 Actual: Paris Saint Germain 0:4 #Nice#PSG #Football#FranceLigue1

AI match predictions

@ai_match_prediction · Post #11717 · 25.04.2026 г., 05:05

France Ligue 1🇫🇷 2026-04-25 13:00 UTC Lyon vs. Auxerre Predicted outcome: Lyon✅ Predicted score: 1:0 Actual: Lyon 3:2 #Lyon#Auxerre 2026-04-25 17:00 UTC Angers vs. Paris Saint Germain Predicted outcome: Paris Saint Germain✅ Predicted score: 1:2 Actual: Paris Saint Germain 0:3 #Angers#PSG 2026-04-25 19:05 UTC Toulouse vs. Monaco Predicted outcome: Monaco❌ Predicted score: 1:2 Actual: Draw 2:2 #Toulouse#Monaco #Football#FranceLigue1

AI match predictions

@ai_match_prediction · Post #11473 · 12.04.2026 г., 09:05

France Ligue 1🇫🇷 2026-04-12 15:15 UTC Nice vs. Le Havre Predicted outcome: Draw✅ Predicted score: 1:1 Actual: Draw 1:1 #Nice#LEHavre 2026-04-12 15:15 UTC Toulouse vs. Lille Predicted outcome: Draw❌ Predicted score: 1:1 Actual: Lille 0:4 #Toulouse#Lille 2026-04-12 18:45 UTC Lyon vs. Lorient Predicted outcome: Lyon✅ Predicted score: 2:1 Actual: Lyon 2:0 #Lyon#Lorient #Football#FranceLigue1

AI match predictions

@ai_match_prediction · Post #11875 · 03.05.2026 г., 05:05

France Ligue 1🇫🇷 2026-05-03 13:00 UTC Lille vs. Le Havre Predicted outcome: Lille❌ Predicted score: 1:0 Actual: Draw 1:1 #Lille#LEHavre 2026-05-03 15:15 UTC Strasbourg vs. Toulouse Predicted outcome: Strasbourg❌ Predicted score: 2:1 Actual: Toulouse 1:2 #Strasbourg#Toulouse 2026-05-03 15:15 UTC Auxerre vs. Angers Predicted outcome: Auxerre✅ Predicted score: 2:1 Actual: Auxerre 3:1 #Auxerre#Angers 2026-05-03 15:15 UTC Paris FC vs. Stade Brestois 29 Predicted outcome: Paris FC✅ Predicted score: 2:1 Actual: Paris FC 4:0 #ParisFC#StadeBrestois29 2026-05-03 18:45 UTC Lyon vs. Rennes Predicted outcome: Lyon✅ Predicted score: 3:2 Actual: Lyon 4:2 #Lyon#Rennes #Football#FranceLigue1

Sos Donbass

@sos_donbass · Post #1699 · 05.11.2025 г., 19:49

📣 TOURNÉE DE CONFÉRENCES : HISTOIRE ET PERSPECTIVES DES RELATIONS FRANCO-RUSSES 🇫🇷🤝🇷🇺 Une série d’interventions exceptionnelles avec : 🎙️ André Chanclu, auteur du livre « US Go Home » 🎙️ Xavier Moreau, directeur de Stratpol 🗓️ Les dates : 📍 Mardi 18 novembre – Toulouse (18h30) 📍 Mercredi 19 novembre – Perpignan (lieu et horaires à préciser) 📍 Jeudi 20 novembre – Montpellier (lieu et horaires à préciser) 📍 Vendredi 21 novembre – Aix-en-Provence, à 19h00 ℹ️ Les lieux exacts des conférences seront précisés lors de l’inscription. 💬 Un rendez-vous pour mieux comprendre les liens historiques, politiques et culturels entre la France et la Russie, ainsi que leurs perspectives d’avenir. 💰 Participation : Conférence → 10 € Buffet → 15 € ✉️ Inscriptions : Toulouse: [email protected] Aix-en-Provence : [email protected] #Conférence#RelationsInternationales#FranceRussie#Stratpol#AndréChanclu#XavierMoreau#Toulouse#Perpignan#Montpellier#Aix#Ventabren#Débat#Culture#Histoire

AI match predictions

@ai_match_prediction · Post #12027 · 10.05.2026 г., 13:05

France Ligue 1🇫🇷 2026-05-10 19:00 UTC Angers vs. Strasbourg Predicted outcome: Strasbourg❌ Predicted score: 1:2 Actual: Draw 1:1 #Angers#Strasbourg 2026-05-10 19:00 UTC Paris Saint Germain vs. Stade Brestois 29 Predicted outcome: Paris Saint Germain✅ Predicted score: 3:1 Actual: Paris Saint Germain 1:0 #PSG#StadeBrestois29 2026-05-10 19:00 UTC Monaco vs. Lille Predicted outcome: Lille✅ Predicted score: 1:2 Actual: Lille 0:1 #Monaco#Lille 2026-05-10 19:00 UTC Rennes vs. Paris FC Predicted outcome: Rennes✅ Predicted score: 2:1 Actual: Rennes 2:1 #Rennes#ParisFC 2026-05-10 19:00 UTC Toulouse vs. Lyon Predicted outcome: Lyon❌ Predicted score: 1:2 Actual: Toulouse 2:1 #Toulouse#Lyon 2026-05-10 19:00 UTC Auxerre vs. Nice Predicted outcome: Auxerre✅ Predicted score: 2:1 Actual: Auxerre 2:1 #Auxerre#Nice 2026-05-10 19:00 UTC Le Havre vs. Marseille Predicted outcome: Le Havre❌ Predicted score: 2:1 Actual: Marseille 0:1 #LEHavre#Marseille 2026-05-10 19:00 UTC Metz vs. Lorient Predicted outcome: Lorient✅ Predicted score: 1:2 Actual: Lorient 0:4 #Metz#Lorient #Football#FranceLigue1