Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
🐬 uShaka Marine World — a themed park opened in 2004 in Durban, KwaZulu-Natal Province.
🏄♂️ It is one of the largest entertainment complexes in South Africa, known for its exciting mix of marine adventures and active recreation. 🐠
🎥 Video: https://t.me/rusbig5/7760
#SouthAfrica#Durban#uShakaMarineWorld#TravelSouthAfrica#ExploreAfrica#AdventureTime
🇿🇦 ЮАР готовится к Рождеству 🎄
Вот так выглядит Дурбан — третий по величине город страны: праздничные огни, океанский бриз и летнее настроение ✨🌴
#Рождество#НовыйГод#ЮАР#Дурбан
_______________
🇿🇦South Africa is getting ready for Christmas 🎄
This is what Durban, the country’s third-largest city, looks like — festive lights, ocean vibes, and a true summer Christmas ✨🌴
#Christmas#NewYear#SouthAfrica#Durban
🏇 Dick Francis (1920–2010) was a British steeplechase jockey (over 350 wins) and the author of 43 crime novels.
📖 The book Smokescreen (1972) and its film adaptation is a detective story set in South Africa.
🎬 Plot: a popular British actor flies to South Africa to find out why an elderly lady’s horses are performing so poorly. But he soon discovers that an ill-wisher is out to get him.
🏇 The novel features detailed accounts of horse races in Durban and thrilling scenes in Kruger National Park, immersing readers in the atmosphere of African adventure.
#DickFrancis#Literature#Books#CrimeFiction#SouthAfrica#Kruger#Durban
🍛Two Iconic South African Curries 🇿🇦
Two of the most famous curries in South African cuisine represent the two port cities — Cape Town on the west coast and Durban on the east. ⚓️
Even their names reflect their origins:
🌶Cape Malay Curry Powder refers to Cape Town’s Malay community,
🔥Durban Curry Masala — to Durban’s Indian community.
The Cape curry is slightly sweeter and milder, while the Durban curry is hotter and more vibrant thanks to the addition of Kashmiri red chili. 🌶
Source: https://t.me/africamother/800
#SouthAfrica#Food#Cuisine#Cooking#CapeTown#Durban#Spices#Curry
The only revolving restaurant in the Southern Hemisphere is in Durban!🇿🇦
The Roma Revolving Restaurant, opened in 1973, is famous not only for its 360° panoramic views of the city but also for its excellent Italian cuisine. 🇮🇹
🍽 It’s located on the 32nd floor of the iconic John Ross House — and we’ll tell you more about this landmark in an upcoming post!
🎥Video (01:53)
#Durban#SouthAfrica#RomaRevolving#Restaurants#Architecture#ItalianFood#TravelSouthAfrica#CityViews
🚩Сегодня, 8 июня 2025, ультрамарафон Comrades стартовал в ЮАР в 08:30 по Екатеринбургу (в 06:30 по Москве) и продлится 12 часов.
На фото — команда марафонцев из Екатеринбурга, которую поддерживает Уральский горнопромышленный холдинг.
Чтобы прочувствовать атмосферу, посмотрите видео!
_______________
🚩 Today’s the day! On June 8, 2025, the Comrades ultramarathon began in South Africa at 8:30 AM Yekaterinburg time (that’s 6:30 Moscow time), and runners have up to 12 hours to finish.
Featured is the Yekaterinburg team, supported by the Ural Mining Holding (UMH).
Click to watch videos to get the feel of the event!
#sport#marathon#Comrades#Durban#Pietermaritzburg#ЮАР#спорт#марафон#Комрадс
🏙The John Ross House in Durban is a 33-storey skyscraper on the iconic Victoria Embankment.
Named after John Ross (real name: Charles Rawden Maclean), who at just 15 years old walked 600 km (370 mi) from Port Natal to Delagoa Bay and back — to bring medicine and supplies to the crew of a shipwrecked vessel. It happened in1825. ⛵️
🗿 A statue of him stands outside the building.
🍽 At the top of the tower is the Roma Revolving Restaurant, offering panoramic views of Durban.
🏢 The building stands 109 meters (358 ft) tall and was renovated in 2009. Today, it serves both residential and commercial purposes.
#Durban#SouthAfrica#Architecture#History#JohnRoss#Landmarks#VictoriaEmbankment#Skyscrapers#RomaRestaurant#Africa
🌴Victoria Embankment in Durban is one of the city’s most iconic waterfront areas — both a major transport route and a symbol of urban identity. 🌆
📍 Along the Embankment you’ll find:
🔹 the famous John Ross House with the Roma Revolving Restaurant
🔹 Durban’s city hall and court buildings
🔹 the historic yacht basin
🔹 monuments, greenery, and sweeping views of the bay
🚶♀️ It’s a perfect place for walks, photos, and taking in the rhythm of Durban’s harbor life — where colonial history meets modern African energy.
📹 Video
#Durban#VictoriaEmbankment#SouthAfrica#Cityscape#Waterfront#History#UrbanAfrica#TravelSouthAfrica#Architecture#JohnRossHouse#ExploreDurban