Ранее я делал серию постов про битовые операторы.
Вот вам ещё один наглядный пример как это используется в 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
#LYFT
LYFT начал пробивать сопротивление - цена выросла почти +80% за месяц - поздравляю всех, кто участвовал в этом ралли.
Что дальше? Ну скорее всего где-то откатит, так как пробитый уровень нужно тестировать = но долгосрочная картина пока бычья.
🛴Americans drift from Uber and Lyft, test alternative forms of transportation
Americans are exploring alternative methods of transportation. Looking at average daily active users (DAUs) per month over the past 13 months, we’re estimating decreases in active usage for #Uber and #Lyft, while seeing increases in active usage for things like public transportation, bikes and scooters.
The above data is for the United States and is a combination of iOS + Google Play apps. Lyft has said its market share in the United States was at about 35% in early 2018, and is now closing in at around 40%. Lyft is losing less average DAUs than Uber, which has in fact grown its percentage of market share in the United States.
Read more on Apptopia.
🚀@PerspectiveIX
🚖 Lyft Closing New User Gap with Uber in U.S. as IPO Approaches
As it prepares for its long-awaited IPO, #Lyft has been slowly yet surely pulling alongside rival #Uber in the United States when it comes to the number of new users both services are adding each month.
According to Sensor Tower, which count first-time downloads of apps by unique App Store and Google Play users, Lyft added close to 1.5 million new riders in the U.S. last month, compared to Uber’s 1.9 million, giving the soon-to-be-public company a 43 percent share of those acquired between the two. This is a significant turnaround from April 2015, when Uber accounted for 82 percent of new U.S. riders added by the two services that month.
Read more on SensorTower.
🚀@PerspectiveIX
🚕Uber vs. Lyft: Loyalty Edition
Ride-sharing customers are becoming less loyal.
Americans who used both #Uber and #Lyft in the last quarter of 2018 accounted for about a third of the companies’ ride-sharing revenue, according to new data from Earnest Research. That’s up 13 percentage points from the beginning of 2016.
🚀@PerspectiveIX via Recode.
🚕Lyft has eaten into Uber’s U.S. market share
#Uber controls the majority of U.S. ride-hailing but #Lyft is growing twice as fast. And both plan to go public in early 2019.
🚀@PerspectiveIX via Recode.
🚗Lyft продаст свое подразделение по производству беспилотных автомобилей подразделению Toyota за $550 млн.
В рамках сделки компании будут работать вместе над повышением безопасности технологий автоматизированного вождения.
📈 Президент Lyft сказал, соглашение позволит им сосредоточиться на продвижении своей автономной платформы и транспортной сети, а также сократить убытки.
На фоне заявления о продаже подразделения, акции Lyft выросли более чем на 2%.
#США#Lyft#Toyota
💰Gig Economy Workers Are Earning Half What They Did Five Years Ago
More people are working for ride-sharing and delivery companies but on average they’re making less.
On average, drivers who transport people (#Uber or #Lyft) or things (#UberEats or #Postmates) through an app made 53 percent less in 2017 than they did in 2013, according to a new study by the JPMorgan Chase Institute.
The average monthly payments to those who worked for a transportation app in a given month declined to $783 from $1,469. Meanwhile, people working for leasing apps — #Airbnb, Turo, Parklee and other apps that let you rent assets like your home, car or parking space — saw their incomes from those platforms rise 69 percent to $1,736 on average.
This is happening as online gig work has become more popular, thanks in large part to the growth in the number transportation jobs.
🚀@PerspectiveIX via Recode.
💰Libra: Facebook confirms its cryptocurrency launching in 2020
#Libra is designed not to be a speculative asset, like #Bitcoin, but a form of digital money backed by a reserve of assets.
The company has formed the nonprofit Libra Association with 27 other partners to oversee Libra and its development. The partnership includes venture capital firms, nonprofit organizations, #cryptocurrency firms, and massive corporate financial, telecommunications, and technology service providers, including #Coinbase, #Mastercard, #Visa, #eBay, #PayPal, #Stripe, #Spotify, #Uber, #Lyft, and #Vodafone.
While the Libra Association will have members based globally, it will be headquartered in Geneva, Switzerland🇨🇭
Facebook has a business incentive to build on top of the Libra #blockchain, and it’s launching its own subsidiary to do just that called #Calibra (see the GIF below - Credit: Facebook). According to Kevin Weil, Facebook's VP of Product, Calibra will live inside of Facebook Messenger and WhatsApp at launch, but will also have a standalone iOS and Android app.
🔗 Read more the Verge.
🚀@PerspectiveIX