Вторая по частоте future-функция, которую я использовал, это абсолютный импорт
from __future__ import absolute_import
Что она делает?
Изменения, которые вносит эта инъекция описаны в PEP328
Покажу простой пример.
Допустим, есть такой пакет:
/my_package
/__init__.py
/main.py
/string.py
Смотрим код в my_package/main.py
# main.py
import string
Простой пример готов) Вопрос в том, какой модуль импортируется в данном случае? Есть два варианта:
1. модуль в моём пакете my_package.string
2. стандартный модуль string
И вот тут вступает в дело приоритет импортов. В Python2 порядок следующий: помимо иных источников, раньше ищется модуль внутри текущего пакета, а потом в стандартных библиотеках. Таким образом мы импортнём my_package.string.
Но в Python3 это поведение изменилось. Если мы указываем просто имя пакета, то ищется именно такой модуль, игнорируя имена в текущем пакете. Если мы хотим импортнуть именно подмодуль из нашего пакета то, мы должны теперь явно это указывать.
from my_package import string
или относительный импорт, но с указанием пути относительно текущего модуля main
from . import string
Еще одной неоднозначностью меньше 😎
Подробней про импорты здесь:
https://docs.python.org/3/tutorial/modules.html
#2to3#pep#basic
🇺🇸New York Proposes Restrictions on AI Chatbots to Protect Children Online
New York Governor Kathy Hochul unveiled State of the State proposals aimed at protecting children from online harms, including predators, scams, and harmful AI chatbots integrated into digital platforms. The legislative package targets social media and online gaming services and explicitly includes disabling certain AI chatbot features for minors. The initiative is framed as part of a broader response to the youth mental health crisis.
The proposals would expand age verification requirements across platforms, mandate “privacy by default” settings for children, restrict unsolicited contact and location sharing, and require parental approval for connections for users under 13. Parents would also gain controls over children’s financial transactions. These measures build on prior New York actions, including bans on smartphones in schools, social media warning labels, restrictions on addictive feeds, and safeguards against AI companions.
In parallel, the Governor proposed a statewide expansion of Teen Mental Health First Aid training, with the goal of enabling every tenth grader to receive training. The initiative complements the expansion of school-based mental health clinics and peer support programs, positioning New York as a leading U.S. jurisdiction linking AI governance, platform regulation, and youth mental health policy.
#AIRegulation#ChildSafety#AIChatbots
Stanford Research Raises Concerns aboutChatbots Use in Legal Field
Greetings everyone! Stanford University's latest research unveils unsettling truths about popular AI chatbots, including OpenAI's ChatGPT and Google's PaLM 2. When faced with legal questions, these widely-used models exhibited "hallucinations" in responses a staggering 75% of the time.
The implications are particularly worrisome for self-represented litigants who rely on these AI tools due to financial constraints. As hopes for AI aiding legal services soar, the study underscores the urgent need for refining these models to ensure accurate and reliable legal assistance
#AILaw#LegalTech#AIChatbots#LegalServices#StanfordResearch
UK Passes Online Safety Bill - AI Chatbots Included
Hello, dear subscribers! The UK's Online Safety Bill, designed to regulate online platforms and protect users, has received approval from the House of Lords, taking it one step closer to becoming law.
This comprehensive 300-page legislation addresses various aspects, from combating the spread of illegal content online to safeguarding social media users from online harassment. Notably, now it introduces provisions concerning AI chatbots like ChatGPT and aims to protect users from harmful content.
#OnlineSafetyBill#AIChatbots#Deepfake#UKRegulation#OnlineSafety
😈Yandere AI maid to fulfill your fantasies. 😈
📲Download and play: http://openlove.life
#AIgirlfriend#roomescape#aigame#aichatbots#neko#catgirl#maid#女仆装