Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в Python в модуле re.
Чтобы указать флаг для компилятора нам надо указать его после передаваемой строки. Например, добавляем флаг для игнорирования переноса строки.
pattern = re.compile(r"(\w+)+")
words = pattern.search(text, re.DOTALL)
А как указать несколько флагов? Ведь явно будут ситуации когда нам потребуется больше одного. Кто читал посты по битовые операторы уже понял как.
pattern.search(text, re.DOTALL | re.VERBOSE)
А теперь смотрим исходники, что находится в этих атрибутах?
Не удивительно, степени двойки. Почему? Потому что каждое следующее значение это сдвиг единицы влево.
>>> for n in [1, 2, 4, 8, 16, 32, 64, 128, 256]:
>>>
print(bin(n))
0b1
0b10
0b100
0b1000
0b10000
0b100000
0b1000000
0b10000000
0b100000000
Чтобы было понятней, давайте напишем тоже самое но иначе, добавим ведущие нули:
000000001
000000010
000000100
000001000
000010000
000100000
001000000
010000000
100000000
Не понятно что тут происходит? Читай три поста про битовые операторы начиная с этого ➡️https://t.me/pythonotes/45
В общем, это пример применения побитовых операций в самом Python.
Теперь вы знаете Python еще немного лучше)
#tricks#regex#libs
## ⛰️ THE ROOF OF AFRICA: WHERE EARTH TOUCHES HEAVEN
## ⛰️ የአፈሪካ ጋራ: ምድር ሰማይ የሚመሰከርበት
🌍 КОГДА ГОРЫ КАСАЮТСЯ НЕБЕС!
Simien Mountains — Ethiopia's crown jewel and UNESCO World Heritage site where ancient volcanic peaks pierce the clouds at 4,500 meters! ⛰️
🌅 THE DRAMATIC LANDSCAPE:
These jagged ridges were sculpted by millions of years of volcanic fury, creating one of Earth's most breathtaking panoramas.
*Эти зубчатые вершины — самый драматичный пейзаж на планете!*
*እነዚህ የተበዳደሩ አጫያዎች በዓለም ውስጥ የተሳከሩ ምብጣት ምክንያቶች ነው!*
Deep gorges plunge 1,500 meters below — called "the chess pieces of the gods" by locals for their dramatic, sharp pinnacles.
🐒 UNIQUE WILDLIFE:
Home to the endangered Gelada baboons — the "bleeding heart" monkeys found NOWHERE else on Earth!
*Самые редкие павианы в мире живут только здесь!*
*በዓለም አንደ ቦታ የሚገኙ የጋላዳ ብድንዎች እዚህ ብቻ ይገኛሉ!*
These gentle giants graze the highland meadows in massive troops, living peacefully at altitudes that would leave most humans breathless.
🌟 KUINDZHI'S VISION BROUGHT TO LIFE:
At sunset, these mountains transform into layers of gold and shadow — like stepping into a painting by the Russian master Arkhip Kuindzhi. Light becomes sculpture, air becomes canvas, and the soul expands infinitely.
*На закате горы превращаются в живую картину Куинджи!*
*በሰሙን መግረብ ጋታ አያቶች የኩይንዅጂ እሳት ይሆናሉ!*
This is Ethiopia. Where nature paints with light and shadows, where time stands still, and where every breath feels sacred.
📸Swipe through:
Photo 1-2: Real dramatic vistas → Photo 3: Algorithmic art in Kuindzhi style!
*Фото 1-2: Реальные панорамы → Фото 3: Алгоритмическое искусство!*
#SimienMountains#የሲሚኤንአያቶች#Ethiopia#ኢትዮጵያ#UNESCO#Kuindzhi#AlgorithmicArt#የአልገሪዝምእሳት#EthiopianHighlands#የኢትዮጵያአያቶች#MountainMagic
🇪🇹@ethiopia
## 🐺 THE SWEET SECRET OF ETHIOPIAN WOLF: NATURE'S RAREST CANID
## 🐺 የኢትዮጵያ ዝዕብ መስጠር: የተፈጥሮ የታታ እንሰሳ
🌸 КОГДА ХИЩНИК ЛЮБИТ СЛАДКОЕ!
Meet Africa's rarest canid — the Ethiopian wolf. Only 500 individuals remain in the world, found NOWHERE else on planet Earth! 🌍
🏞️ THE EXCLUSIVE HABITAT:
These magnificent predators live only in Ethiopia's highlands — Simien and Bale Mountains — where their reddish-golden fur glows like fire in the sunset light.
*Рыже-золотая шерсть сияет как огонь на закате!*
*የፊያ-ዋሪራው ምስዚው በሰሙን መግረብ በክትት እናት ይችጋል!*
🌸 THE SWEET DISCOVERY:
Here's the secret scientists discovered — these apex predators have a SWEET TOOTH! Ethiopian wolves visit giant Red-hot Poker flowers (Kniphofia) to lick nectar for glucose energy in the thin highland air.
*Учёные открыли: волки любят сладкий нектар!*
*የሳይንስ ልምዓን ገለጫቹ: ዝዕቦች ሳኳ ከማቃ ይፈልጋሉ!*
Imagine: a fierce hunter perfectly adapted to chase rodents at 4,000 meters altitude, pausing gently to lick sweet nectar from vibrant orange blooms.
*Представьте: свирепый охотник нежно слизывает нектар с цветка!*
Nature's poetry!
⚡ WHY THIS MATTERS:
This behavior reveals the deep connection between predator and plant, hunter and flower.
*Глубокая связь между хищником и растением!*
*በእንሰሳ እና ዕጥዋት ማካከል የተፈጥሮ አጋጣጠን!*
In Ethiopia, even wolves understand the sweetness of life.
🌅 KUINDZHI'S GOLDEN HOUR:
At sunset, when light paints everything in warm tones, the Ethiopian wolf becomes a living artwork — like stepping into Kuindzhi's masterpiece where every shadow tells an ancient story.
*В золотой час волк становится живой картиной!*
*በዋሪራ ሰዓት ዝዕብ የተገለጻ የእሳት እን፤ቤቶች ይሆናል!*
📸 Swipe through:
Photo 1: Wolf licking nectar (TONGUE VISIBLE!) → Photo 2: Artistic shot → Photo 3: Kuindzhi algorithmic art!
*Фото 1: Волк с языком! → Фото 3: Алгоритмическое искусство!*
#EthiopianWolf#የኢትዮጵያዝዕብ#Ethiopia#ኢትዮጵያ#EndangeredSpecies#የተዘገጡእንሰሳቶች#Wildlife#የብራት#Nectar#Kuindzhi#AlgorithmicArt#የአልገሪዝምእሳት#RareBeauty
🇪🇹@ethiopia
# 💦 TIS ISSAT: THE SMOKING WATER OF BLUE NILE
## 💦 ጥስ ኢሳት: የገባዊ አባይ ተሥታት ውሃ
🌊 КОГДА ВОДА ПОЁТ И ДЫШИТ!
Blue Nile Falls — one of Africa's most powerful waterfalls! Locals call it "Tis Issat" meaning "Smoking Water" because of the massive spray that creates a permanent rainbow in the mist. 🌈
⚡ THE UNSTOPPABLE POWER:
During rainy season, over 400,000 cubic meters of water PER SECOND crash down 45 meters! The thunderous roar echoes for kilometers.
*400,000 кубометров воды В СЕКУНДУ!*
*በሳምንት 400,000 ኩብ ሜትር ውሃ የሚወርድ!*
The earth trembles, the air fills with mist, and nature reminds us of her eternal strength.
🌈 THE RAINBOW MAGIC:
A perpetual rainbow dances in the waterfall's mist throughout the day when sunlight breaks through.
*Вечная радуга танцует в тумане!*
*የመቀጠል ቋቅደም በመታት ውስጥ ይየጫል!*
Nature's own light show, playing since the beginning of time!
🏞️ 4,000 YEARS OF HISTORY:
These falls have witnessed Ethiopian civilization since ancient times. Emperors stood here, poets wrote verses, lovers made eternal promises.
*Вода падает уже 4000 лет, равнодушная к времени!*
*የውሃ አባይ ከታና ኦዛ እስከ ማዲተራኔአን በመወረድ ይጋዝ!*
The water keeps falling, eternal in its journey from Lake Tana to the Mediterranean Sea.
☀️ KUINDZHI'S VISION ALIVE:
When dramatic light breaks through storm clouds — god rays illuminating the sacred waters — it's like witnessing Kuindzhi's masterpiece come to life. The Russian master painted light as sculpture; here, nature does the same!
*Божественные лучи как в картине Куинджи!*
*የእገዚአብሄር ልመዶች እናት ኩይንዅጂ እሳት!*
This waterfall doesn't just fall — it sings, it breathes, it lives. It's the heartbeat of the Blue Nile, the pulse of Ethiopia! 💙
📸Swipe through:
Photo 1-2: Real waterfall power → Photo 3: Kuindzhi algorithmic art with god rays!
*Фото 1-2: Реальная мощь → Фото 3: Алгоритмическое искусство!*
#BlueNileFalls#የገባዊአባይጠራጣ#TisIssat#ጥስኢሳት#Ethiopia#ኢትዮጵያ#Waterfall#የውሃአባይ#Rainbow#Kuindzhi#AlgorithmicArt#የአልገሪዝምእሳት#NaturalWonder#የተፈጥሮአግጣጠን
🇪🇹@ethiopia