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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #205 · 22 јан.

Как работает функция reload()? Эта функция нужна для того, чтобы перезагрузить изменившийся код из py-файла без рестарта интерпретатора. Дело в том, что любой импортированный модуль при повторном импорте не будет перечитывать файл. Функция импорта вернёт уже загруженный в память объект модуля. Чтобы обновить код, нужно либо перезапустить всю программу, либо использовать функцию reload() from importlib import reload reload(my_module) 🔸 Функция reload() принимает в качестве аргумента только объект модуля или пакета. Она не может перезагрузить класс или функцию. Только весь файл целиком! 🔸 Перезагрузка пакета перезагрузит только его файл __init__.py, если он есть. Но не вложенные модули. 🔸Она не может перезагрузить ранее не импортированный модуль. 🔸При вызове функция reload() перечитывает и перекомпилирует код в файле, создавая новые объекты. После создания новых объектов перезаписывается ранее созданный неймспейс этого модуля. Это значит, что если где-то этот модуль импортирован через import и обращение к атрибутам происходит через неймспейс (имя) модуля, то такие атрибуты обновятся. Если какие-либо объекты из этого модуля импортированы через from то они будут ссылаться на старые объекты. Напишем простой модуль # mymodule.py x = 1 Теперь импортируем модуль и отдельно переменную х из модуля >>> import mymodule >>> from mymodule import x >>> print(mymodule.x) 1 >>> print(x) 1 Не перезапуская интерпретатор вносим изменения в модуль # mymodule.py x = 2 Делаем перезагрузку модуля и проверяем х ещё раз >>> reload(mymodule) >>> print(mymodule.x) 2 >>> print(x) 1 То же самое будет если присвоить любой объект переменной (даже словарь или список) Повторный импорт обновляет значение >>> from mymodule import x >>> print(x) 2 🔸Созданные инстансы классов не обновятся после перезагрузки модуля. Их придётся пересоздать. #tricks#basic

Резултати

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

Пребарај: #euai

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

@ai_and_law · Post #720 · 10.12.2025 г., 08:04

🇪🇺EU FRA Flags Rights Risks in High-Risk AI Deployment The EU Agency for Fundamental Rights has released a report showing that many developers and deployers of high-risk AI systems lack the knowledge or tools to mitigate impacts on fundamental rights. The assessment covers the use of such systems in asylum procedures, education, employment, law enforcement, and the administration of public benefits: areas where algorithmic decisions can directly affect access to essential services and legal protections. The FRA recommends expanding the definition of AI to better reflect fundamental-rights considerations and issuing clear guidance on how to conduct impact assessments. According to the report, these steps are necessary to ensure that high-risk AI systems are developed and deployed in ways that do not compromise individuals’ rights across critical public domains. #AIandLaw#FundamentalRights#EUAI#AIRegulation

AI & Law

@ai_and_law · Post #436 · 06.11.2024 г., 08:04

Strengthening the EU’s AI Leadership Through Investment and Strategic Governance The EU Council has endorsed the European Court of Auditors’ call to elevate AI ambitions within the EU, emphasizing increased, targeted investments and enhanced governance. Recognizing AI’s potential to drive Europe’s global competitiveness, the Council urges a focus on fostering AI talent and creating an ecosystem built on excellence and trust. Moreover, the Council highlights the importance of considering environmental impacts, especially in energy efficiency and the reliability of the hardware supply chain, as the EU moves forward with AI policies. By reinforcing collaboration with member states and international partners, the EU aims to position itself as a global leader and benchmark in AI governance. #AIGovernance#EUAI#SustainableAI #

AI & Law

@ai_and_law · Post #761 · 10.02.2026 г., 08:04

🇪🇺European Parliament Pushes New Copyright Safeguards for AI The European Parliament’s Committee on Legal Affairs has approved an own-initiative report proposing new measures to strengthen copyright protection in the context of generative AI. The proposals include mandatory transparency obligations on training data practices for all generative AI systems placed on the EU market. MEPs also call for remuneration mechanisms for rightsholders and the development of voluntary, sector-specific collective licensing agreements. The report is not legally binding but signals political direction and will be submitted for a vote by the full Parliament during the March plenary session. #AIandCopyright#EUAI#GenerativeAI#CopyrightLaw#AIRegulation

AI & Law

@ai_and_law · Post #73 · 02.08.2023 г., 07:04

Leading the Way in Responsible AI: The EU's Vital Opportunity Hello, AI enthusiasts! Today, we share a policy brief by Pegah Maham and Sabrina Küspert from the Stiftung Neue Verantwortung. They highlight the EU's significant chance to take the lead in responsible AI development through the AI Act and beyond. But to seize this opportunity, understanding the risks associated with general-purpose AI models is essential. 🔹 Risks from Unreliability: One major concern is the lack of control over AI models' behavior. This unreliability could lead to serious issues like discrimination and stereotype reproduction, spreading misinformation, and violating individual privacy. 🔹 Misuse and Dual-Use AI Models: The dual-use nature of some AI models poses another challenge. While they offer immense benefits, they can also be misused by malicious actors for cybercrime, biosecurity threats, and politically motivated purposes. 🔹 Systemic Risks: As AI rapidly integrates into our society, systemic risks emerge. These risks include economic power concentration and inequality, ideological homogenization, and disruptions from the lagging adaptation of society. By comprehending and addressing these risks, the EU can establish itself as a global leader in responsible AI development. #ResponsibleAI#AIRegulation#AIAct#AIChallenges#EUAI#TechPolicy#DigitalFuture#AICommunity