Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
🏝️ Tourism tax levy on Bali
The new tourism tax levy, introduced on the 14th of February, 2024, makes it mandatory for all international tourists to pay IDR 150,000 ($9.25) in tourism taxes.
The Bali Tourism Police have been instructed to conduct more spot checks on tourists to catch those who have not paid the tourism tax levy.
Despite the fact that the new tourism tax has already raised $3.9 million, this is only a fraction of what tourism officials should have in the bank by now.
It has been calculated that as much as 60% of tourists haven’t been paying their tourism tax levies.
@BaliNews
#economics#tourism
📈Indonesian economy grows faster than forecasts
📰 Indonesia's GDP growth for 2Q 2024 was 5.05%, exceeding analysts' forecasts, according to the country's statistics agency.
📈 Household consumption remains the main sector of the Indonesian economy with a contribution to overall growth of 55%. Manufacturing and construction sectors are next in terms of volume.
👍 The country's finance minister forecasts GDP growth of more than 5% for the whole of 2024.
@BaliNews
#goodnews#economics
🤑Bali to make a center for family offices in the region
🏝 Investment Minister Luhut has proposed to make Bali an alternative center for wealthy investors, on par with Singapore and Hong Kong, which are setting up family offices to do business.
📈 The minister shared statistics from Singapore, where there is a boom in such offices and added that he is now receiving many requests to set up an investment hub in Bali between Singapore, Hong Kong and Dubai.
🪙 A number of issues remain to be sorted out by the authorities to make this possible. First and foremost is to amend the tax laws or create a special economic zone in Bali. So far all income, including foreign income, such offices will have to declare inside Indonesia and pay taxes on it. This goes against the classical offshore jurisdictions, where such income is not taxed.
#statistics#economics
📈Indonesia's budget for 2025 – which sectors are expected to grow the most
The Indonesian government approved a $230 billion budget for next year. Bloomberg looked at which sectors of the Indonesian economy will benefit from it, and which public companies will show the most growth.
📈The obvious winners of the new budget:
・Food industry
・Healthcare
・Commercial and hotel real estate
・Automotive industry
・Mining
・Green energy
That said, there are also potential losers in the form of large construction companies following a 6% cut in infrastructure spending.
Overall, Indonesia's stock market has performed enviably well when compared to Europe or Asia. For example, the growth over 10 years amounted to 47%.
@BaliNews
#economics#business
💰 BlackRock установили рекорд — под их управлением $11 триллионов. Компания управляет активами, которые превосходят по своей капитализации ВВП Китая, Индии и РФ вместе взятых.
Black Rock - это не просто инвесторы. Это и есть реальная власть, управляющая миром с помощью финансовых инструментов.
BlackRock владеет блокирующим пакетом акций в половине публичных компаний США. У фонда около 10 % акций Coca-Cola и PepsiCo, он является крупнейшим инвестором в Boeing и Airbus, Apple и Microsoft. Также Black Rock владеет акциями конкурирующих горнодобывающих и нефтяных компаний, сталелитейных заводов, автомобильных гигантов и, банков, в том числе всех из так называемой "большой четверки".
Им же принадлежат блокирующие пакеты акций в трех крупнейших фармацевтических компаниях Америки - Pfizer, Johnson & Johnson и Merck.
Есть данные, что под непрямым управлением Black Rock находится порядка 10 % всех финансовых активов мира. Но данные остаются остаются слухами, потому BlackRock владеет от 8 до 18 % акций таких крупнейших медиакомпаний, как CNN, CBS, Fox, Disney, ABC.
#Economics#Окно_Овертона
Emir in India: Whenever Modi has a bilateral visit, Adani’s not far behind
https://www.newslaundry.com/2025/02/19/emir-in-india-whenever-modi-has-a-bilateral-visit-adanis-not-far-behind
https://archive.vn/fyWKK
#geopolitics#economics#india
🌍 The world’s largest diamond trading hub is not near a mine but in Antwerp, Belgium. Over 80% of all rough diamonds pass through this city, shaping global trade far from their origin. ✨
#economics⚡#trade⚡#cities⚡#geography⚡#nature⚡#earth
👉subscribe Amazing Geography
👉more Channels