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

Резултати

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

Пребарај: #pov

当前筛选 #pov清除筛选
Virtual 207

@the_mutarjim · Post #20192 · 20.12.2025 г., 05:30

#PoV Sad news for French readers: publishing house Harlequin has decided to stop publishing human-made translations in French, and will instead rely on AI. All of their freelance translators (some of whom had been working with Harlequin for more than 30 years!) were told they would no longer receive translation work. They can, however, work with Fluent Planet (Harlequin's new partner, that will provide the AI translations) to "improve their AI-translations" (or, given the quality of AI translation, rewrite entirely the text from scratch)... for 1/3 of their normal rates (which were already pretty low to begin with). Of course, despite the cost-saving mesure for Harlequin, French readers will still be required to pay their books the same price... while getting butchered translations. This is not without consequences: ● Translators suddenly no longer being offered work from Harlequin is the equivalent of a mass lay-off... But as freelancers, they do not get any unemployment benefits or compensation. ● Working with Fluent Planet instead of Harlequin means the translators are no longer considered like authors/artists under the French law, but like external contractors. This means that on top of having their revenues divided by three, they lose various legal rights (such as the right to be credited as a literary translator in the book!), protections and grants. ● This is incredibly disrespectful to the original works that are now ran through AI translation softwares. These softwares were trained on both Harlequin's French collection and the original source texts, without the authors' and translator's consent (and none of them was paid for that, even though Fluent Planet is now making money out of these AI softwares). New books published are now translated by an AI, still without the original authors' consent (who probably aren't too happy about that). Lots of nuance, cultural reference and stylistic choices will be lost. Do not be fooled by the fact that Harlequin's books are "just romance books". Romance is far from being the easiest genre to translate, and romance-readers, as paying customers, deserve exactly the same respect as any other readers, and that is: high-quality translations. AI might be coming for romance first, but it will not stop there if we, readers, translators, authors, literary agents, publishers, do not push back. Let Harlequin know we don't want their AI-butchered books, we don't want their dystopian future were human art and emotions are left to robots, we don't want to support company that let go of their workforce without a second-thought, just so numbers keep going up indefinitely. We're not paying a dime for AI slop! © Apolline Descy, Freelance translator (English-Dutch-Spanish​>French) specialised in game localisation, literature and medical translation

Hashtags

Железно | Киров

@gk_zhelezno · Post #766 · 12.03.2023 г., 11:26

#pov — смотрим на город будущего глазами жителей ZNAKа. У людей, окружающих себя красотой, развивается эстетический вкус. Обостренное чувство прекрасного активизирует способности альтернативного восприятия. Это означает, что человек начинает видеть возможности там, где другие их не находят. Просыпайтесь каждый день с удовольствием, наслаждайтесь видами из окон, гуляйте по благоустроенной территории своего жилого комплекса и проводите больше времени с любимыми в городе будущего ZNAK — месте, полном возможностей для вашей счастливой жизни❤️ #ZNAK

Hashtags

IRAS

@irassg · Post #775 · 09.02.2024 г., 06:50

Bracing for the annual CNY “kaypoh” questions too? 😅 Here’s one thing less to worry about – use the Personal Relief Checker (go.gov.sg/personalreliefchecker) to discover the personal tax reliefs you're eligible for in the upcoming tax season! 🔍 #pov#skit#cny2024#asianrelatives#taxreliefs#taxtips#irassg

12
ПретходнаСтраница 1 од 2Следна