Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
Macron Sounds Brave on Israel, Frugal at Home
Emmanuel Macron condemned Israel over the blocked Palm Sunday procession in Jerusalem, calling freedom of worship something that must be guaranteed for all religions.
Fair enough — except this is the same French president whose government is now offering only tightly targeted fuel aid because, as France’s central bank put it, there is “no more money” for broad subsidies.
That’s the modern European posture in miniature: moral thunder abroad, budget discipline at home.
Macron can scold Israel for trampling holy sites, but when French drivers and businesses get squeezed by the oil shock, Paris reaches for a scalpel, not a blanket. The principles are grand; the compensation is minimal.
And that tension is the point. The Middle East crisis has pushed fuel prices higher across Europe, but France’s answer has been cautious, targeted relief rather than the old-school political sugar rush of big subsidies.
So Macron gets to play the global conscience while his own finance people remind everyone that righteousness does not pay the diesel bill.
#Macron#France#Israel#Jerusalem#fuelprices#MiddleEast#politics
📱American Оbserver - Stay up to date on all important events
🇺🇸
🚢Рекордные премии на бункер вынуждают суда искать топливо в азиатских хабах.
Резкий рост цен на морское топливо на фоне конфликта на Ближнем Востоке привёл к серьёзным сбоям в бункеровке судов в крупнейших азиатских портах. По данным участников рынка, стоимость топлива выросла более чем в два раза по сравнению с уровнем до начала конфликта.
В крупнейшем мировом бункеровочном хабеСингапуре цена низкосернистого топлива превысила $1 000 за тонну, а премии на спотовом рынке достигли рекордных уровней — значительно выше отметки $200 к базовым котировкам.
Суда всё чаще сталкиваются с задержками при бункеровке, что может привести к росту загруженности портов Сингапура, Шанхая и Нинбо-Чжоушань.
Перенаправление судов из-за ограничений транзита через Ормузский пролив также увеличивает поток трафика в азиатские порты.
По оценке аналитиков, многие поставщики переходят на спотовые продажи, избегая долгосрочных контрактов из-за высокой волатильности цен.
Дополнительное давление на рынок создаёт сокращение поставок топочного топлива из стран Ближнего Востока.
Для судоходной отрасли это означает рост операционных затрат, увеличение времени ожидания в портах и дополнительное давление на фрахтовые ставки.
📌Linerlytica — аналитическая компания в сфере морской логистики и контейнерных перевозок, специализирующаяся на анализе глобальных торговых потоков и портовой статистики. Компания является частной и принадлежит основателям и инвесторам.
#Bunkering#FuelPrices#SingaporePort#ShippingCosts#MaritimeTrade
🚀 Poland's Central Bank Highlights CPI Risks from Fuel Price Policies
Poland's central bank has identified fiscal policies and regulations related to fuel prices as ongoing risks to the Consumer Price Index (CPI). According to Jin10, these factors continue to pose challenges to the country's inflation outlook. The central bank's assessment underscores the importance of monitoring fuel-related policies as they can significantly impact inflation rates. Policymakers are urged to consider these risks in their economic strategies to ensure stability in the CPI.
#Poland#CentralBank#CPI#FuelPrices#Inflation#FiscalPolicies#EconomicStability#InflationRisks
🚀 Middle East Conflict Could Severely Impact Australia's Economy, Expert Warns
Calculations and analyses are currently underway regarding the potential impact of the ongoing Middle East conflict on Australia's fuel prices and economic growth. According to Jin10, David Rumbens, a partner at Deloitte Access Economics, has stated that the worst-case scenario would severely affect Australia. A prolonged conflict could drive oil prices up to $175 per barrel, with inflation rates reaching 7.5% by the end of the year. The ultimate outcome could see Australia's unemployment rate rise to 6.8%, while the GDP growth rate could decline by 2.8%. Notably, none of the proposed scenarios indicate an unemployment rate below 5.0%.
#MiddleEastConflict#AustraliaEconomy#FuelPrices#EconomicGrowth#Inflation#Unemployment#GDPGrowth#OilPrices#DavidRumbens#DeloitteAccessEconomics
🚀 Macquarie: Southeast Asia Fuel Prices Surge Amid Iran Conflict
Macquarie stated in a stock research report on April 9 that fuel prices in Southeast Asia have significantly increased and are unlikely to return to pre-Iran conflict levels in the short term. According to Jin10, the firm remains optimistic about energy-related industries, including alternatives like crude palm oil, while advising against non-essential consumer goods, hotels, and leisure sectors. Macquarie noted that after a substantial rise in oil prices, it typically takes about six months for consumer inflation to show a significant increase. The report also mentioned that energy subsidies in Malaysia and Indonesia might temporarily mitigate the negative impact on consumers.
#SoutheastAsia#FuelPrices#IranConflict#Macquarie#EnergyIndustries#CrudePalmOil#ConsumerInflation#OilPrices#EnergySubsidies#Malaysia#Indonesia