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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #60 · 31 мар.

Вторая по частоте 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

Резултати

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

Пребарај: #danon

当前筛选 #danon清除筛选
MessageInABottle

@mib_messageinabottle · Post #6929 · 24.05.2024 г., 17:08

REACTIONS TO ICJ RULING ON ISRAEL'S GENOCIDE IN GAZA #Israel was ordered by the International Court of Justice (#ICJ), or world court, on Friday to halt its military assault on the city of #Rafah in #Gaza Here are some of the reactions so far, via #Reuters: #Hamas official Basem #Naim: We welcome the decision by the world court that calls on the Zionist occupation forces to end its military aggression on Rafah. We believe it is not enough since the occupation aggression across the Gaza Strip and especially in northern Gaza is just as brutal and dangerous. We call upon the UN security council to immediately implement this demand by the world court into practical measures to compel the Zionist enemy to implement the decision. We welcome the court’s request to allow investigation committees to reach the Gaza Strip to investigate acts of war of genocide against the Palestinian people and Hamas pledges to cooperate with investigation committees.” #Palestinian Authority spokesperson #AbuRudeineh: The presidency welcomes the decision issued by the International Court of Justice, which represents an international consensus on the demand to stop the all-out war on Gaza.” #Israeli finance ministerBezalel #Smotrich: Smotrich said demanding Israel stops the war against Hamas was tantamount to demanding that Israel decide to cease to exist. “Israeli will not agree to that,” he said in a statement. Israeli opposition leader Yair #Lapid: Lapid condemned Friday’s ruling by the ICJ for failing to draw a connection between its demand for an end to the fighting with a demand to return Israeli hostages held in Gaza. Normally a fierce critic of Israeli prime inister Benjamin Netanyahu, Lapid said the court’s failure to link the two issues was “a moral collapse and a moral disaster”. #EU foreign policy chief Josep #Borrell: What is going to be the [EU’s] answer to the ruling of the International Court of Justice that has been issued today, what is going to be our position? We will have to choose between our support to international institutions of the rule of law or our support to Israel.” #SouthAfrican offical Zane #Dangor: South Africa welcomes the ruling made by the court today … This order is groundbreaking as it is the first time that explicit mention is made for Israel to halt its military action in any area of Gaza. This is de facto calling for a ceasefire. It is ordering the major party in this conflict to end its belligerent action against the people of Palestine.” Former Israeli #UN envoy Danny #Danon: As ICJ judges in The Hague deliberate in comfort and return to their families, 125 hostages languish in tunnels. Israel will not cease the war until our hostages are brought back home and Hamas is completely defeated.” ++++++++++++++++