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

Пребарај: #privacylaw

当前筛选 #privacylaw清除筛选
AI & Law

@ai_and_law · Post #643 · 26.08.2025 г., 07:04

🇺🇸Otter.ai Faces Class Action Over Voice Data and AI Training A lawsuit filed in California alleges that Otter.ai violated the U.S. Electronic Communications Privacy Act, the Computer Fraud and Abuse Act, and multiple California statutes by recording individuals’ voices without consent and using them to train its AI models. The complaint, led by Justin Brewer, emphasizes that while Otter users may accept recordings, non-users—who are not asked for permission—are also captured, raising broader legal and ethical concerns. The case highlights a growing fault line: enterprise transcription and note-taking apps like Otter.ai, Read.ai, and Google Gemini are designed for convenience, yet their silent background operation may expose organizations to litigation. With over 100 potential plaintiffs, this class action underscores a central governance challenge—whether AI tool providers can rely on implied consent in multi-party conversations, or if explicit legal standards will redefine acceptable data practices in enterprise AI. #AIethics#DataProtection#PrivacyLaw#AIGovernance

AI & Law

@ai_and_law · Post #741 · 13.01.2026 г., 08:04

🇭🇰Hong Kong Issues Deepfake Protection Toolkit for Schools Hong Kong’s Office of the Privacy Commissioner for Personal Data (PCPD) has published guidance on the use of an AI deepfake protection toolkit aimed at schools and parents. The guidance explains common types of deepfakes and typical scenarios involving abusive deepfakes in school settings, focusing on risks faced by students. The toolkit provides practical measures for prevention and incident response, outlining the roles of schools, parents, and students. Recommended school-level safeguards include data minimization, restricting access to personal data, and implementing general data security measures to reduce exposure to deepfake misuse. The initiative frames deepfake risks as a data protection and child safety issue, reinforcing the role of privacy governance and preventive controls in educational environments as generative AI tools become more accessible. #AIandLaw#Deepfakes#DataProtection#ChildrenRights#PrivacyLaw#AIRegulation

AI & Law

@ai_and_law · Post #99 · 30.08.2023 г., 07:04

Zoom Addresses EU Privacy Concerns and Updates Terms of Service Greetings! In response to discussions about potential EU privacy law implications, Zoom issues a statement and revises its Terms of Service. The focus? Ensuring customer data isn't utilized to train AI models. Zoom's statement and Terms affirm that user-generated content, including audio, video, chat, and more, isn't employed for training Zoom's or any third-party AI models. This step aims to dispel any concerns. Zoom initially shared its statement on August 7 and later updated it on August 11, aligned with the revised Terms. The shared stance now unequivocally states, "Zoom does not use any of your customer content to train AI models." Earlier, a Stack Diary article flagged changes to Zoom's March Terms, raising potential concerns about broad data utilization for AI model training. Zoom's quick response aims to address these concerns and reaffirm privacy commitments. #Zoom#PrivacyMatters#TermsOfService#AIModels#DataProtection#PrivacyLaw#TechUpdates