TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #156 · 2 окт.

Те, кто в Python не первый день, хорошо знают, что на число можно умножить не только число, но и другие типы. Главное, чтобы у этих типов была реализация такой операции. # list >>> [1] * 3 [1, 1, 1] # tuple >>> (2, 3) * 3 (2, 3, 2, 3, 2, 3) # string >>> "A" * 3 "AAA" Так работает полиморфизм стандартных типов. Интересно здесь то, что это сработает и в том случае, когда порядок операндов обратный. То есть int умножить на [тип]. # list >>> 3 * [1] [1, 1, 1] # tuple >>> 3 * (2, 3) (2, 3, 2, 3, 2, 3) # string >>> 3 * "A" "AAA" Если хотите реализовать такое поведение в ваших классах то следует помнить два момента: 1. Если множитель справа, то вам нужно реализовать метод __mul__, наш класс это первый операнд, то есть слева. myType * 3 2. Если множитель слева, то вам нужно реализовать метод __rmul__, наш класс это второй операнд, справа. 3* myType Всё тоже самое можно делать и для других математических операторов. И если в этом примере действие и результат будут фактически одинаковыми, то бывают ситуации, когда это не так. Например, при умножении матриц имеет значение порядок операндов. Для других операторов, таких как деление или сдвиг, очень важно кто с какой стороны находится. >>> 2/4, 4/2 (0.5, 2.0) >>> 2<<3, 3<<2 (16, 12) >>> 100%15, 15%100 (10, 15) #tricks#basic

Резултати

Пронајдени 7 слични објави

Пребарај: #cryptotwitter

当前筛选 #cryptotwitter清除筛选
DigitalGenie Trading News

@digitalgentop · Post #242 · 06.06.2024 г., 10:59

🔖McHenry urges Senate to pass FIT21 crypto bill before election The United States House’s widely positive vote on the crypto-regulating FIT21 bill should be “a wake-up call” to the Senate to quickly pass it, says Rep. Patrick McHenry 💬 #Cryptotrader #Cryptotwitter #Cryptoinvestment #Cryptocurrencyexchange

Venture Village Wall 🦄

@venturevillagewall · Post #3669 · 21.12.2024 г., 13:51

USAcoin Proposal by Peter Schiff Peter Schiff suggests that instead of building a strategic reserve in BTC, the U.S. could save money by launching a new cryptocurrency called USAcoin, which would have a capped supply of 21 million coins, utilizing updated blockchain technology for payment efficiency. He emphasizes the potential wealth this could generate and encourages HODL. 🔗Read more here🔗Join Crypto Twitter #USAcoin#Cryptocurrency#BTC#Blockchain#PaymentSystems#Investment#WealthBuilding#HODL#Crypto#Finance#PeterSchiff#CryptoTwitter#DigitalCurrency

Venture Village Wall 🦄

@venturevillagewall · Post #3504 · 19.12.2024 г., 14:22

BTC Buying Surge Amid Drops Despite a slight drop in Bitcoin prices, major players are buying in: 🔵 Marathon purchased BTC worth $1.53 billion. 🔵 BlackRock acquired $359 million in BTC. 🔵 Hut8 invested $100 million. 🔵 Michael Saylor likely preparing to buy another $3 billion. 🔥 States are also secretly accumulating Bitcoin. #Bitcoin#Marathon#BlackRock#Hut8#MichaelSaylor#Crypto#Investment#Market#Trading#Assets#Finance#DigitalCurrency#Blockchain#CryptoTwitter#BTC#Bullish#Wealth#Economy#Currency

Venture Village Wall 🦄

@venturevillagewall · Post #3842 · 10.01.2025 г., 22:00

Bitcoin Mining Ban and Market Resilience In 2021, China's ban on Bitcoin mining caused market panic, leading to a significant dip. However, this event has less relevance now. Bitcoin continues to show resilience despite fluctuations. Data from PumpFun reveals that only 0.4% of meme coin traders made over $10,000, while 60% ended with losses. Most users either broke even or earned little. For insights on meme coin trading, check this post. #Bitcoin#Crypto#Trading#MemeCoins#MarketTrends#Mining#Investing#Blockchain#Finance#PumpFun#Statistics#MarketDip#Profit#Losses#Trader#Wealth#InvestmentStrategy#CryptoTwitter

Venture Village Wall 🦄

@venturevillagewall · Post #3857 · 12.01.2025 г., 16:00

FTX Announces Preliminary Fund Distribution Schedule 🔵 FTX reveals a preliminary payment distribution schedule for creditors. 🔵 Claims under $50k total $1.2 billion. 🔴 By January 20: Preliminary claims must be met. 🔴February 25 - March 4: Expected period for fund distribution begins. 🤔 Will this bring additional liquidity to the market? Read more #FTX#Crypto#Market#Liquidity#Payments#Claims#Finance#Investments#Bitcoin#News#Updates#Distribution#Schedule#CryptoTwitter#Investors#Creditors#Funds#Return#January#February#March