Вторая по частоте 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
Seville, #Spain
Metropol Parasol (the Metropol umbrella, Spanish The Metropol Parasol, also known as the Mushrooms of Seville, is a concrete and wooden structure located in the Plaza de la Encarnacion. Plaza de la Encarnación) in the old quarter of Seville. The building was designed by German architect Jürgen Mayer, and construction was completed in April 2011. The 28-meter-high facility covers an area of 150 by 75 meters and claims to be the largest wooden structure in the world.
Fuerteventure, #Spain🇪🇸
This wonderful natural pool is located on the island of Fuerteventure. 🏝
Interestingly, Fuertever is considered one of the oldest islands of Spain, formed thanks to the eruption of the volcano more than 20 million years ago. This fact confirms the unusual form of the island and the complete absence of snakes and insects dangerous for humans. Also, the pluses of this place should include an almost complete absence of rains and a soft climate.
🇪🇸#Spain / Catalonia: There were intense clashes yesterday in Sentmenat (Barcelona) between anti-fascist protesters and riot police.
Groups of demonstrators took to the streets to oppose the opening of a new delegation and headquarters by the neo-Nazi group Núcleo Nacional. Hundreds of anti-fascist activists gathered near the industrial area where the far-right group was holding an event, leading to police charges as officers attempted to prevent protesters from reaching the venue.
(📹 via @rebonico on X)
🇪🇸#Spain: Europol and the Spanish National Police have uncovered a far-right accelerationist cell linked to The Base. Three suspects were arrested during coordinated raids in Madrid, Valencia and Castellón, with officers seizing firearms, ammunition, knives, tactical gear, and accelerationist/neo-Nazi propaganda.
According to investigators, the cell was "highly radicalised" and it had conducted paramilitary style training, while being allegedly in contact with The Base's founder, Rinaldo Nazzaro. Only a month ago, The Base issued messages on its Telegram channels urging the consolidation of its dispersed international cells.
(via The Guardian)
😍When talking about Barcelona, one immediately thinks of the Sagrada Familia.
📏
📏
📏
📏
📏
📏
📏
📏
After 137 years, this landmark has become one of the most visited not only in Catalonia but in all of Europe.
🌟
📏
📏
📏
📏
📏
📏
📏
📏
#Spain🇪🇸
@voyage
🗺Spain 🇪🇸
📏
📏
📏
📏
📏
📏
📏
📏
Mount Tibidabo — the highest point in the Spanish city of Barcelona, part of the Collserola range.
📏
📏
📏
📏
📏
📏
📏
📏
🌟From this hill, you get a stunning panorama of the Catalonian capital, enjoyed by both tourists and locals. Though relatively low at just over 500 meters above sea level, both the mountain and its summit attractions are visible from anywhere in the city.
📏
📏
📏
📏
📏
📏
📏
📏
#Spain
@voyage
November in Barcelona is pure magic
✨
📏
📏
📏
📏
📏
📏
📏
📏
💚This area between Urquinaona Square and Paseo de San Juan Avenue is a treasure trove of architectural masterpieces! Every building here is a work of art, rich in history and unique charm.
📏
📏
📏
📏
📏
📏
📏
📏
💚Imagine walking down a narrow street, the autumn leaves rustling underfoot, with majestic buildings towering around you, adorned with elegant balconies and carved doors. Time seems to slow down, and you’re immersed in the atmosphere of old Barcelona.
📏
📏
📏
📏
📏
📏
📏
📏
#Spain🇪🇸
@voyage
Spain 🇪🇸
Mount Tibidabo — the highest point in the Spanish city of Barcelona, part of the Collserola range.
From this hill, you get a stunning panorama of the Catalonian capital, enjoyed by both tourists and locals. Though relatively low at just over 500 meters above sea level, both the mountain and its summit attractions are visible from anywhere in the city.
#Spain
@voyage