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

Резултати

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

Пребарај: #josephaoun

当前筛选 #josephaoun清除筛选
Marwa Osman/MidEaStream

@Marwa_OsmanLB · Post #3848 · 09.01.2025 г., 13:30

Army Chief #JosephAoun has officially been elected as #Lebanon’s new president, marking a significant moment in the country’s political landscape. Despite being a political newcomer, Aoun’s position as head of one of Lebanon’s most respected institutions has bolstered his appeal. Widely regarded as the favored candidate of both the United States, a staunch supporter of the Lebanese army, and regional power Saudi Arabia, Aoun is seen as the best-equipped to navigate Lebanon through its fragile ceasefire and crippling financial collapse. Turning 61 on Friday, Aoun, known for his "personal integrity," is now tasked with stepping into the void left by Michel Aoun—no relation—whose presidency ended in October 2022

Marwa Osman/MidEaStream

@Marwa_OsmanLB · Post #4188 · 25.03.2025 г., 04:13

Lebanese daily @alakhbarnews reported that #SaudiArabia remains firm in its stance, maintaining economic pressure on #Lebanon. According to visitors to #Riyadh, the kingdom has conveyed that it will not contribute "a single penny" to Lebanon’s reconstruction efforts. Well-informed sources indicate that President #JosephAoun indirectly received this message during his meeting with Saudi Crown Prince #MohammedbinSalman earlier this month. Additionally, he was reportedly met with a firm Saudi refusal to lift the travel ban on its citizens visiting Beirut. During their discussions, bin Salman reportedly questioned Aoun on whether he could guarantee the safety of Saudi nationals traveling along Beirut’s airport road, which is lined with images of #Hezbollah and Iranian leaders. He remarked, “At the very least, remove the pictures.” Upon his return, Aoun relayed this request to Speaker of Parliament #NabihBerri, inquiring about the possibility of reducing the number of such images along the route. Why do you think Saudi Arabia cares about images displayed in another country? Share your thoughts with Hoopoe.

Marwa Osman/MidEaStream

@Marwa_OsmanLB · Post #3850 · 10.01.2025 г., 10:10

Following a two-year vacancy, the Lebanese Parliament has elected #JosephAoun as the new President of the Republic. Here's what you need to know about him. #LebanonPresident#LebanonPolitics#PresidentialElection#Lebanon#LebaneseParliament#MiddleEastPolitics