Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
Nubeo и Atari выпустили часы Automatic Atari Asteroids 45th Limited Edition
Дизайн часов отсылает к классической игре Asteroids: секундная стрелка выполнена в форме треугольного космического корабля, а две летающие тарелки являются соответственно часовой и минутной стрелками.
Часы выпущены в пяти расцветках, по 125 экземпляров каждой, но весь тираж уже, увы, распродан по предзаказам.
#Asteroids#Atari#Nubeo
NASA probe will study Jupiter's Trojan asteroids
NASA launched a first-of-its kind mission to study Jupiter's Trojan asteroids
#News#Reuters#NASA#Jupiter#Asteroids
Subscribe: http://smarturl.it/reuterssubscribe
Reuters brings you the latest business, finance and breaking news video from around the globe. Our reputation for accuracy and impartiality is unparalleled.
Get the latest news on: http://reuters.com/
Follow Reuters on Facebook: https://www.facebook.com/Reuters
Follow Reuters on Twitter: https://twitter.com/Reuters
Follow Reuters on Instagram: https://www.instagram.com/reuters/?hl=en
➖@reutersworldchannel➖
🪐 Asteroid (2015) BN509, a giant space rock measuring about 200 meters wide and 400 meters long, speeds past Earth with a shape resembling a giant peanut. Its close flyby in 2017 brought it within just 14 times the distance to the Moon, and radar imaging revealed its rapid rotation and elongated, tumbling motion—features that could make its path unpredictable if nudged by gravity. ✨
#asteroids⚡#hazards⚡#space⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos
👉subscribe Universe Mysteries
👉more Channels
🪐 The asteroid (29075) 1950 DA stands out not only for its size but for its unique structure—it’s held together mostly by the tiny forces between individual grains, known as van der Waals forces, rather than by its own gravity. This means that if 1950 DA ever impacted Earth, its loosely-bound material could break apart differently than a solid rock, making its potential effects more unpredictable compared to typical asteroids. ✨
#asteroids⚡#hazards⚡#space⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos
👉subscribe Universe Mysteries
🪐 The asteroid 1950 DA, about 1 kilometer wide, is hurtling through space with an orbit that brings it close to Earth every few decades. Scientists monitor it closely because its surface is so loosely held together by gravity that only tiny forces—like sunlight pressure—keep it from flying apart, making it a uniquely fragile but potentially dangerous near-Earth object. ✨
#asteroids⚡#hazards⚡#space⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos
👉subscribe Universe Mysteries
🪐 The asteroid 99942 Apophis, discovered in 2004, is a near-Earth object about 340 meters wide that will make an extremely close pass by Earth in 2029—closer than some satellites! Though it once raised fears of an impact, precise tracking shows it will safely miss us, offering astronomers a rare chance to study such a large asteroid up close as it sweeps just 31,000 kilometers above our planet. ✨
#asteroids⚡#nearEarth⚡#astronomy⚡#nasa⚡#galaxy⚡#stars⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 The asteroid (136617) 1994 CC is a rare triple system, meaning it consists of one main asteroid about 700 meters wide and two smaller moons orbiting it. This near-Earth object follows a path that occasionally brings it close enough to be watched by planetary defense teams, as its complex system could create unpredictable trajectories in the event of a gravitational nudge. ✨
#asteroids⚡#spacehazards⚡#astronomy⚡#nasa⚡#galaxy⚡#stars⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 In the constellation Ophiuchus, the asteroid 101955 Bennu harbors boulders on its surface that are actually fragments from a much larger parent asteroid, dislodged by ancient cosmic impacts. Analysis of samples returned by NASA’s OSIRIS-REx mission revealed minerals that interacted with liquid water billions of years ago, revealing Bennu as a time capsule from the dawn of the solar system. ✨
#Bennu⚡#asteroids⚡#OSIRISRex
👉subscribe Universe Mysteries
🪐 Asteroid (1862) Apollo is one of the first discovered "Apollo-type" near-Earth asteroids, regularly crossing Earth's orbit on its journey around the Sun. Measuring about 1.5 kilometers wide, Apollo's path is closely monitored because its changing orbit brings it close enough to qualify as potentially hazardous—a reminder of why astronomers track even ancient space rocks to protect our planet from unexpected encounters. ✨
#asteroids⚡#hazards⚡#monitoring⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 In 2013, the small asteroid 2012 DA14, about 30 meters wide, passed just 27,700 kilometers above Earth—closer than many weather satellites. Unlike much larger objects, even an asteroid this size could cause massive regional destruction if it ever struck, which is why astronomers keep careful watch for these smaller, fast-moving near-Earth objects. ✨
#asteroids⚡#hazards⚡#monitoring⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 Asteroid (2015) BP513 is a near-Earth object discovered in 2015, which measures around 440 meters across and has an orbit that occasionally brings it within a few lunar distances of our planet. While it poses no immediate threat, its path is tracked closely by astronomers, since an object of this size could cause severe regional damage if it ever collided with Earth—a reminder of why the study and monitoring of such asteroids are vital for planetary defense. ✨
#asteroids⚡#hazards⚡#monitoring⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels
🪐 Asteroid (86039) 1999 NC43 is a massive near-Earth object more than 2 kilometers wide that follows a path bringing it close to our planet's orbit. Its size means that if it ever collided with Earth, it could cause planet-wide devastation, so astronomers keep a careful watch on its movements using radar to track any changes in its trajectory. ✨
#asteroids⚡#hazards⚡#monitoring⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels