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

Резултати

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

Пребарај: #legalaction

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

@ai_and_law · Post #160 · 09.11.2023 г., 08:04

Scarlett Johansson Sues AI App for Unauthorized Voice Cloning in Ad Hello, dear subscribers! Scarlett Johansson is taking legal action against an AI app developer for using her voice in an online ad without her consent. The ad in question featured an AI-generated version of Scarlett Johansson's voice endorsing an AI image editor, Lisa AI: 90s Yearbook & Avatar. The 22-second ad began with the real Johansson and then transitioned to an AI-generated voice imitating her. The actress's representatives stated that Johansson was not associated with the app in any capacity. Her attorney is pursuing legal action to address the situation. As AI technology continues to advance, cases of unauthorized use of celebrity voices and likenesses are expected to increase, raising questions about the boundaries of AI in media and advertising. #ScarlettJohansson#AI#VoiceCloning#LegalAction

AI & Law

@ai_and_law · Post #322 · 05.06.2024 г., 07:04

Schumacher Family Awarded €200,000 Over AI-Generated Interview Michael Schumacher's family has been awarded €200,000 ($217,000) in compensation by a German magazine that falsely claimed to have conducted an exclusive interview with the Formula One legend. Die Aktuelle published the interview last April, suggesting it was an exclusive with Schumacher, who has not appeared in public since a serious brain injury from a skiing accident in December 2013. The end of the article revealed the interview to be entirely generated by AI. The Schumacher family pursued legal action, resulting in a settlement confirmed by the Munich Labor Court. Funke media group, which owns Die Aktuelle, apologized and terminated the contract of the editor-in-chief responsible for the publication. The family continues to maintain strict privacy regarding Schumacher's condition, with limited information shared even in a recent Netflix documentary about his life and career. #Schumacher#FormulaOne#AI#Privacy#LegalAction

AI & Law

@ai_and_law · Post #161 · 10.11.2023 г., 08:04

Artist Lawsuit Over AI Image Generators Faces Challenges Hello, dear subscribers! In the ongoing lawsuit against AI image generators by artists, several claims were dismissed by US district Judge William H. Orrick. Notably, two of the three plaintiffs in the case had not registered their disputed works with the Copyright Office, leading to the dismissal of their claims. However, the lead plaintiff, Sarah Andersen, has 30 days to amend her complaint and continue the copyright dispute. The artists allege that AI image generators infringe on their copyrights, claiming direct and vicarious infringement, violations of the Digital Millennium Copyright Act, and California laws related to unfair competition and rights to publicity. They argue that AI-generated images should be considered derivative works based on copyrighted content. While the case proceeds, the judge has called for clarification on how image generators work, especially regarding "compressed copies" of images and the operation of AI systems like Stable Diffusion. The lawsuit remains complex, with the core claim of direct copyright infringement proceeding against Stability AI but not against DeviantArt and Midjourney. The artists will need to address the many issues identified in their claims, including specifics regarding copyright management information and rights of publicity. #AIImageGenerators#CopyrightLawsuit#AIandArt#LegalAction

Crypto M - Crypto News

@CryptoM · Post #65344 · 13.04.2026 г., 01:32

🚀 WLFI Denies Justin Sun's Allegations of Token Contract Vulnerability Justin Sun recently accused the WLFI token contract of having a 'backdoor' that allows for arbitrary freezing of user assets. According to ChainCatcher, WLFI officials have denied these allegations and announced plans to pursue legal action.WLFI representatives stated that Justin Sun's accusations are defamatory and unfounded, portraying himself as a 'victim.' They noted that such public accusations are not new. WLFI claims to have gathered relevant contract and evidence materials and intends to confront Justin Sun in court. #WLFI#JustinSun#TokenContract#Backdoor#FreezingAssets#Defamation#LegalAction#ChainCatcher#Court

Crypto M - Crypto News

@CryptoM · Post #64536 · 09.04.2026 г., 06:43

🚀 Odin Fun Addresses Security Breach with Multiple Measures Odin Fun co-founder Bob Bodily announced that several initiatives are underway to address the recent security breach. According to Foresight News, the platform is being restored to its pre-attack state, and efforts are being made to retrieve large cryptocurrency withdrawals made after the incident. The company is collaborating with law enforcement and exchanges to track and freeze the attackers' funds and is preparing for legal action. Coordination is also ongoing with other Bitcoin protocols affected by third-party smart contract vulnerabilities. The vulnerability has been identified, fixed, verified, and redeployed. A comprehensive third-party smart contract audit is in progress. Odin Fun is maintaining continuous communication with the main community to reach the best solution and is discussing with users the optimal path for platform relaunch. Previously, on April 1, Odin Fun experienced an unusual large-scale sell-off, primarily involving a few meme coins like BURRITO and CRYPTOBURG. Subsequently, multiple users reported abnormal account balances and unauthorized withdrawals of BTC and tokens. #OdinFun#SecurityBreach#Cryptocurrency#SmartContracts#LawEnforcement#Bitcoin#CryptoSecurity#ForesightNews#PlatformRestoration#LegalAction#CommunityCommunication#ThirdPartyAudit#BTC#UnauthorizedWithdrawals#MemeCoins#BURRITO#CRYPTOBURG