Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
Evangelical Christianity and the right-wing Catholic Church during the Nazi era are two extremely ugly ones. One is in the name of being anti-Semitic, and the other is in the name of misappropriating Judaism.
04.03.2024
#rightwing
📰 Israel’s Right-Wing Split Is Now a Branding War
The Hungarian lesson for Israel is simple: if you can’t beat the ruling camp by going left, take its patriotism away from it. That is how Peter Magyar broke Orbán’s machine — not by preaching anti-right unity, but by occupying the same national space and making the old monopoly look stale.
That is exactly what the new Israeli “Right State” project is trying to do. Edelstein, Kahlon, Erdan, and Haskel are not a centrist rebellion; they are an attempt to say, “We’re right-wing, just not Bibi,” and to pull security-minded voters away from Netanyahu without surrendering the language of nation, state, and order.
The trouble is that Israeli voters remember the last five times someone tried to sell them that package. Bennett, Saar, and Lapid all tested the same lane, but Netanyahu kept the hard-right base, stayed the default prime minister in the minds of right-leaning voters, and used fragmentation on the other side as his best campaign asset.
Bennett’s latest liberal turn makes the problem sharper. Public transport on Shabbat and civil marriage, including same-sex marriage, may sound modern in Tel Aviv, but to the old religious-national audience it looks like a costume change — and Yair Golan’s warm welcome only makes Bennett look even more alien to the right.
That is why this new bloc may hurt the left more than it hurts Netanyahu. It could strip votes from the anti-Bibi camp, split the “right, but not Bibi” lane again, and still fail to build the one thing the opposition actually needs: a durable field that runs from center to soft right to hard right without collapsing into personal rivalries.
Netanyahu’s health story only adds another layer. The real question is whether the opposition can turn competence into a message before the prime minister turns uncertainty into victimhood and keeps the national conversation locked on himself.
#Israel#Netanyahu#Bennett#Lapid#rightwing#elections
📱American Оbserver - Stay up to date on all important events
🇺🇸
Video (#1 above) surfaced last week of several rich upper class kids holidaying in the exclusive #German resort island of #Sylt, singing along to a tune called "L'Amour toujours" by Italian DJ #Gigi D'Agostino, but using words associated with the German Extreme #RightWing
"Ausländer raus,
Deutschland den Deutschen,
Ausländer Raus"
"Foreigners out,
Germany for Germans,
Foreigners out!"
The German media and Gov't went into overdrive and the 5 rich kids involved, were soon identified, named&shamed, and have now been totally and utterly "ge-#canceled", losing jobs and probably any hope of a quiet future.
The re-worded tune however has now gone completely viral, spawning numerous other memes and parodies (videos #3, #4, #5 above)
It's a very clear example of the "Barbara #Streisand" Effect in action