@learnrcrussian · Post #4290 · 02.03.2025 г., 10:00
Eсли бы блин с начинкой был человеком If a blin with a filling were a human ❓Which one would you prefer😉? Source: Pikabu #just_a_joke #Shrovetide #holidays 😎 Stay with @learnRCRussian
Hashtags
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
Пребарај: #shrovetide
@learnrcrussian · Post #4290 · 02.03.2025 г., 10:00
Eсли бы блин с начинкой был человеком If a blin with a filling were a human ❓Which one would you prefer😉? Source: Pikabu #just_a_joke #Shrovetide #holidays 😎 Stay with @learnRCRussian
Hashtags
@learnrcrussian · Post #4288 · 02.03.2025 г., 09:08
🇷🇺Some Russian spirit of Maslenitsa for you, comrades! Video photo:✈️grafynia #holidays #Shrovetide #memes 😎 Stay with @learnRCRussian
Hashtags
@learnrcrussian · Post #4285 · 01.03.2025 г., 14:00
В моём теле была лёгкость и энергия, двадцать блинов назад ... My body felt light and energetic, twenty pancakes ago... #just_a_joke #Shrovetide #holidays #memes 😎 Stay with @learnRCRussian
@learnrcrussian · Post #4284 · 01.03.2025 г., 12:00
🥞Russian Blini: A Quick Recipe Ingredients: ☆1 cup milk ☆1 cup flour ☆1 egg ☆1 tablespoon sugar ☆Pinch of salt ☆2 tablespoons melted butter (plus extra for greasing) Instructions: 1. Whisk together milk, egg, sugar, and salt. 2. Gradually add flour, whisking until smooth. 3. Stir in melted butter. 4. Let batter rest for 15-30 minutes. 5. Lightly grease a hot pan. 6. Pour 1/4 cup batter onto the pan for each blini. 7. Cook for 1-2 minutes per side, until golden brown. 8. Serve warm with your favourite toppings (sour cream, jam, red caviar). 💢 By the way: • Печь блины [pech bli-ny] doesn't only mean to bake blini but also to skip pebbles on the water. Did you know it? Video: AI Pinterest 😋Yummy! What's your favourite topping/filling for Russian blini? #Russian_cuisine #holidays #Shrovetide 😎 Stay with @learnRCRussian
@learnrcrussian · Post #4287 · 02.03.2025 г., 07:19
🌝С Масленицей! Happy Shrovetide! 🔻Maslenitsa (or Shrovetide), a week-long traditional Russian festival before Lent, culminates in Forgiveness Sunday. 🔻This significant day precedes Great Lent, marking a time for asking forgiveness and reconciliation. 🔻The week-long celebration leading up to it features the vibrant Russian tradition of Maslenitsa, including feasts, games like the thrilling greased pole climb, the burning of a winter scarecrow, and joyous performances of folk songs, lively chastushki (short humorous Russian songs), and energetic Russian folk dances. 🔻Maslenitsa remains incredibly popular, showcasing Russia's rich cultural heritage and is celebrated by Russians not only in Russia but in other countries as well. Video: an episode from Russian film Сибирский цирюльник by Nikita Mikhalkov (1998) #Maslenitsa #Shrovetide #holidays #Russian_culture #ForgivenessSunday 😎 Stay with @LearnRCRussian