TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #83 · 11 мај

У строки в Python есть два очень похожих метода. На столько похожих что кажется они делают одно и тоже. Это метод isdigit() и isnumeric() Давайте посмотрим зачем нам два одинаковых метода? И так ли они одинаковы? Очевидно что isdigit() говорит нам, состоит ли строка только из чисел 0-9 >>> '12'.isdigit() True >>> '12x'.isdigit() False >>> '-12'.isdigit() False >>> '12.5'.isdigit() False Можно предположить что isnumeric() делает более глубокий анализ и распознаёт в строке float или отрицательное число. >>> '15'.isnumeric() True >>> '-15'.isnumeric() False >>> '15.2'.isnumeric() False Нет, всё так же как и с другим методом. В чем же тогда разница? Для начала посмотрим следующие примеры: >>> '5'.isdigit(), '5'.isnumeric() # Обычная цифра 5 # True, True >>> '꧕'.isdigit(), '꧕'.isnumeric() # Яванская 5 # True, True >>> '෩'.isdigit(), '෩'.isnumeric() # Синхала 3 # True, True >>> '৩'.isdigit(), '৩'.isnumeric() # Бенгальская 3 # True, True >>> '༣'.isdigit(), '༣'.isnumeric() # Тибетская 3 # True, True >>> '³'.isdigit(), '³'.isnumeric() # 3 верхний индекс (степень) # True, True >>> '𝟝'.isdigit(), '𝟝'.isnumeric() # Математическая двойная 5 # True, True >>> '๔'.isdigit(), '๔'.isnumeric() # Тайская 4 # True, True >>> '➑'.isdigit(), '➑'.isnumeric() # 8 в круге # True, True А теперь примеры в которых, по мнению Python, результаты не равны >>> '¾'.isdigit(), '¾'.isnumeric() # дробь три четверти # False, True >>> '⅕'.isdigit(), '⅕'.isnumeric() # дробь одна пятая # False, True >>> '𒐶'.isdigit(), '𒐶'.isnumeric() # клинопись 3 # False, True >>> '三'.isdigit(), '三'.isnumeric() # 3 из унифицированной идеограммы # False, True >>> '⑩'.isdigit(), '⑩'.isnumeric() # цифра 10 в круге # False, True >>> 'Ⅳ'.isdigit(), 'Ⅳ'.isnumeric() # Римская 4 # False, True >>> '𑇪'.isdigit(), '𑇪'.isnumeric() # Сенегальская архаическая 10 # False, True >>> '𐌢'.isdigit(), '𐌢'.isnumeric() # Этрусская цифра 10 # False, True >>> 'ↂ'.isdigit(), 'ↂ'.isnumeric() # Римская цифра 10000 # False, True >>> '〇'.isdigit(), '〇'.isnumeric() # Символ ККЯ ноль # False, True Получается, что isdigit() говорит нам, является ли символ десятичной цифрой или спецсимволом, имеющим цифирное значение после преобразования. В свою очередь isnumeric() включает все дополнительные символы юникода которые имеют отношения к числовым и цифровым представлениям. Ну и пара примеров в которых в обоих случаях символ не является числом, это эмодзи. >>> '🕙'.isdigit(), '🕙'.isnumeric() # эмодзи 10 часов # False, False >>> '7️⃣'.isdigit(), '7️⃣'.isnumeric() # эмодзи 7 # False, False Также есть еще один дополнительный и весьма полезный метод isdecimal(). Он нам сообщает, можно ли из указанного символа сделать простую десятичную цифру. То есть сработает ли метод int(x) >>> '෩'.isdecimal(), int('෩') # Синхала 3 # True, 3 >>> '➑'.isdecimal(), int('➑') # 8 в круге # False, ValueError Какие выводы? 🔸 При определении цифры в строке isdigit() подходит лучше чем isnumeric(), но оба не гарантируют успешную конвертацию в int 🔸 Для однозначного определения возможности преобразования строки в int лучше подходит метод isdecimal() 🔸 Для однозначного определения символов 0...9 лучше использовать regex Полный список символов юникода которые определяются как numeric #basic

Hashtags

Резултати

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

Пребарај: #edps

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

@ai_and_law · Post #670 · 02.10.2025 г., 07:04

🇪🇺Human Oversight in Automated Decision-Making: EDPS Weighs In The European Data Protection Supervisor (EDPS) has released a new TechDispatch examining the role and limits of human oversight in automated decision-making technologies (ADMT). The report highlights both the necessity of human involvement and the risks of overestimating its effectiveness. While oversight is often seen as a safeguard against bias, misclassification, and opacity in ADM systems, the EDPS warns that inserting humans into the process does not automatically guarantee fairer or safer outcomes. The paper underscores that flawed assumptions about human involvement can lead to weak or symbolic oversight, risking harm to individuals and undermining fundamental rights such as privacy, non-discrimination, and due process. For oversight to be meaningful, it must be carefully designed, accounting for the complexities of human-machine interaction and ensuring accountability remains with system providers and deployers. The EDPS calls for structured approaches that align oversight practices with ethical standards, societal values, and democratic principles. #AIRegulation#FundamentalRights#EDPS

AI & Law

@ai_and_law · Post #704 · 18.11.2025 г., 08:04

🇪🇺EDPS Releases New Guidance on AI Risk Management for EU Institutions The European Data Protection Supervisor has issued guidance designed to help data controllers assess risks when developing, procuring, or deploying AI systems. Although targeted at EU institutions, offices, and agencies, the document also serves as a practical reference for private organizations aiming to align AI practices with existing data protection obligations. The guidance outlines a structured approach to risk management methodology, emphasizes AI life cycle oversight, and integrates interoperability considerations. It also examines specific categories of risk and pairs them with corresponding technical mitigation measures — offering a clearer operational pathway for organizations working to embed data protection into AI governance. #AI#Law#AIGovernance#EDPS#DataProtection

AI & Law

@ai_and_law · Post #326 · 10.06.2024 г., 07:04

EDPS Issues Guidance on Data Protection for Generative AI Systems The European Data Protection Supervisor (EDPS) has released new guidance on ensuring data protection compliance when using generative AI systems. This guidance is pivotal, given the EDPS's crucial role in the AI Act. According to the AI Act, the EDPS will: ✅ Establish AI regulatory sandboxes for EUIs ✅ Participate as an observer in the European AI Board ✅ Supervise EUIs under the AIA ✅ Act as a market surveillance authority for EUIs ✅ Impose administrative fines on EUIs. These roles mean that the EDPS's interpretations and guidance on AI development and use will significantly impact other AI operators. Despite lack of specificity in some areas, the guidance provides a good initial overview of key challenges in generative AI. #AI#DataProtection#EDPS#AIAct#GenerativeAI

AI & Law

@ai_and_law · Post #792 · 25.03.2026 г., 08:04

🇪🇺EDPS Defines Role Under the EU AI Act The European Data Protection Supervisor (EDPS) published a report outlining its responsibilities as the AI Act market authority for AI systems used by EU institutions. The document sets out priority areas for the next two years as the EDPS assumes its new supervisory role. The report details the EDPS’s tasks under the AI Act mandate, the operational context for exercising its authority, and four strategic pillars that will guide its work as a market authority. #AIRegulation#EUAIAct#DataProtection#AIgovernance#EDPS

AI & Law

@ai_and_law · Post #745 · 19.01.2026 г., 08:04

🇪🇺EDPS Launches Podcast Series on Emerging AI Trends The European Data Protection Supervisor has launched a new podcast series examining key AI trends identified in its TechSonar 2025–26 report. The six-part series focuses on how emerging AI technologies intersect with data protection, security, and fundamental rights. The first episode discusses agentic AI, with EDPS officials addressing risks for personal data protection and potential impacts on individuals’ decision-making autonomy. Upcoming episodes will cover AI companions, automated proctoring, AI-driven personalized learning, coding assistants, and confidential computing. #AIRegulation#DataProtection#EDPS#AITrends#ResponsibleAI

AI & Law

@ai_and_law · Post #142 · 19.10.2023 г., 07:04

European Data Protection Supervisor Weighs In on AI Liability Rules Hello, everyone! The European Data Protection Supervisor (EDPS) provided valuable insights into the European Commission's two proposals, addressing liability rules for artificial intelligence products. These proposals focus on establishing liability for AI developers producing "defective products" and defining civil liability regulations for individuals negatively affected by AI systems. The EDPS presented several key recommendations. Notably, they emphasized the need for uniform protection levels, ensuring that individuals harmed by defective AI systems employed by EU institutions receive the same protection as those impacted by a private entity's use of such systems. These recommendations highlight the ongoing efforts to shape comprehensive AI liability frameworks in the European Union, aiming to balance innovation and safeguard individual rights. #AIandLaw#EDPS#AILiability#EURegulations