Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
🐈⬛NEW RELEASE
🐈⬛
🐈⬛Master the Move: Toreando Guard Pass by John Danaher
🐈⬛
🐈⬛Master one of the most dominant and reliable guard passing systems in Brazilian Jiu-Jitsu with Master the Move: Toreando Guard Pass by John Danaher.
🐈⬛In this comprehensive instructional, he turns his attention to the toreando (bullfighter) pass—arguably the highest percentage and most versatile guard pass in the sport.
$197
🐈⬛$19.99
🐈⬛
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱📱
💰Submeta FOR FREE
👑MasterClass
✈️@bjjfanaticsinstructionals
#JohnDanaher#Passing#NoGi#NewWave
🐈⬛Buy
🐈⬛
🔥NEW RELEASE🔥
😁Master The Move: The Knee Cut Guard Pass By John Danaher😁
➡️The knee cut pass is one of the most dominant and highest-percentage guard passes in Brazilian Jiu-Jitsu—and no one understands it more deeply than John Danaher.
➡️From controlling the far-side shoulder and dominating the near-side hip, to precise knee placement, underhook mechanics, and passing posture, nothing is left unexplained
$197😍$19.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
👑MasterClass
✈️@bjjfanaticsinstructionals
#JohnDanaher#Passing#NoGi#NewWave
💁♀️Buy
💁♀️
🔥NEW RELEASE🔥
😁Master The Move: The Shoulder Crunch Series By John Danaher😁
➡️Learn The Shoulder Crunch System That John Danaher’s Elite Students Use To Break Through Modern No-Gi Guards & Control Opponents Like Never Before
➡️This position has become a staple in the arsenal of Danaher’s most successful students, including Gordon Ryan and Giancarlo Bodoni, for its ability to shut down modern pressure passing, neutralize resistance, and launch devastating attacks.
$197😍$19.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#JohnDanaher#NewWave#NoGi#Guard
💁♀️Buy
💁♀️
🔥NEW RELEASE🔥
😁Master The Move: The Butterfly Guard Sweep Sumi Gaeshi by John Danaher😁
➡️In Master The Move: The Butterfly Guard Sweep Sumi Gaeshi, Danaher breaks down what many consider the single most effective sweep in grappling.
➡️Now, for the first time, Danaher reveals the complete system behind the Sumi Gaeshi sweep from butterfly guard — the same position that connects effortlessly to leg locks, back takes, and devastating top control sequences.
$197😍$19.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#JohnDanaher#Sweeps#NoGi#NewWave
💁♀️Buy
💁♀️
🔥NEW RELEASE🔥
😁Master The Move: The Back Crucifix By John Danaher😁
➡️Unlock one of the most dominant and devastating positions in Brazilian Jiu-Jitsu with Master The Move: The Back Crucifix, a groundbreaking instructional series by legendary coach John Danaher
➡️The back crucifix is unique — it doesn’t earn points in competition, yet it offers extraordinary submission opportunities through unparalleled control and leverage.
➡️In this meticulously crafted series, Danaher breaks down every nuance of the back crucifix, revealing how to achieve, maintain, and capitalize on this position with precision.
$197😍$19.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#JohnDanaher#Crucifix#NoGi#NewWave
💁♀️Buy
💁♀️
🔥NEW RELEASE🔥
😁Master The Move: The Side Crucifix By John Danaher😁
➡️Unlock the power of the Side Crucifix with John Danaher in this must-have instructional video from his best-selling "Master The Move" series
➡️With clear, step-by-step instructions, John reveals the fundamental principles behind the Side Crucifix, a position that allows you to dominate your opponent with high-percentage attacks, all without requiring advanced athletic ability.
➡️If you want to improve your upper body submission game and finish your opponents with efficiency and precision, the Side Crucifix is your new go-to position
$197😍$19.99😍
❗️Channel Info and FAQ (MUST CHECK BEFORE BUY)❗️
📱Payment: 📱📱📱
💰Submeta FOR FREE
🌈UFC Picks
👑MasterClass
✈️@bjjfanaticsinstructionals
#JohnDanaher#BJJFanatics#NewWave#NoGi#Danaher
💁♀️Buy
💁♀️