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

Резултати

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

Пребарај: #usergrowth

当前筛选 #usergrowth清除筛选
Venture Village Wall 🦄

@venturevillagewall · Post #4090 · 07.02.2025 г., 13:00

Polymarket Thrives Amid Trader Growth Betting platform Polymarket defies expectations, expanding active traders by over 50% to 462,000 since November. However, open interest dropped significantly from $500M to $100M, and trading volume halved from a peak of $2.6B to $1.2B. For detailed insights, visit Forklog's news. #Polymarket#Betting#Trading#Crypto#Finance#MarketTrends#StakeholderEngagement#UserGrowth#Blockchain

Crypto M - Crypto News

@CryptoM · Post #64566 · 09.04.2026 г., 08:31

🚀 Go Inc. Dominates Japan's Taxi Hailing Market Go Inc. operates the leading taxi hailing application in Japan, boasting the highest number of users in the country. Bloomberg posted on X, highlighting the company's significant presence in the Japanese market. The app's popularity underscores Go Inc.'s influence in the transportation sector, as it continues to expand its user base and enhance its services. This development reflects the growing demand for convenient and efficient transportation solutions in urban areas across Japan. #GoInc#Japan#TaxiHailing#Transportation#UrbanMobility#Bloomberg#UserGrowth

Venture Village Wall 🦄

@venturevillagewall · Post #3812 · 07.01.2025 г., 13:00

Investment Rounds Highlight New Innovations RoboForce secures $10M to create a Robotic Workforce for heavy tasks. JAN3 raises $5M for Bitcoin technology aimed at increasing access globally. Mocean Energy Ltd gets $539.99K to enhance ocean wave energy tech. CopyCat raises $500K for AI automation of browser tasks. Spintly secures $407.85K to streamline smart access control integration. Additionally, SettleTON emerges as a new DeFi solution on the TON ecosystem, boasting $250k TVL and 30k active users monthly. More details available in the blog. #AI#Crypto#VC#Robotics#Bitcoin#DeFi#FinTech#OceanEnergy#Automation#SmartAccess#Investment#Blockchain#Technology#Liquidity#NFT#EcoSystem#Efficiency#TechInnovation#UserGrowth#Funding