@djangoproject · Post #155 · 04.09.2016 г., 12:23
https://anthony-zhang.me/blog/python-bound-methods/ when & why we use @#staticmethod
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @cryptoattack · Post #20607 · 2 окт.
😨Главное за сегодня: 🇺🇸США (крипто-#ETF): - Заявка Bitwise на запуск #XRP-#ETFпопала на сайт SEC - притоки/оттоки #BTC/#ETH #ETF 🍿#FTT FTX выставили на аукцион 22,3 млн заблокированных #WLD (~38 млн $) со скидкой от 40% до 75% 💰#WLD#AI OpenAI закрыли раунд финансирования на сумму 6,5 млрд $ при оценке >150 млрд $ 🇷🇺#BTCCEO BitRiver: Российские майнеры могут выйти в лидеры, оставив США позади, на горизонте 2-3 лет 🆕 Upbit листит#W (Wormhole) 🚀 💰 Трейдер превратил 368$ в 2 млн $ на #HIPPO (sudeng) всего за 3 дня 🚀 🥳#APT Franklin Templeton добавили блокчейн Aptos для поддержки токенизированного фонда денежного рынка 😨#TONПавел Дуров уточняет: Telegram может раскрывать властям IP-адреса и номера телефонов преступников с 2018 года 🔮 Апелляционный суд постановил, что рынок прогнозов Kalshi может продолжать работу и заключать контракты, разрешающие делать ставки на выборы 🙅♂ Kraken прекращает поддержку Monero (#XMR) в Европейской экономической зоне 🗣#BTCQCP Capital: Влияние ситуации на Ближнем Востоке носит краткосрочный характер, готовность рынка покупать рискованные активы остается сильной 📈#SUI#SCA Общая сумма кредитования Scallop превысила 100 млрд $ 🥊 COPA и Unified Patents начали кампанию против криптовалютных «патентных троллей» 🙋♂#EIGEN#ZRO LayerZero и Eigen Labs представили децентрализованную верификационную сеть CryptoEconomic (DVN) Framework 🤝Партнёрства: - #LINK Taurus и Chainlink сотрудничают для стимулирования внедрения токенизированных активов #RWA - #AVA Ava Protocol интегривались с Soneium от Sony 🕵️♂️Активность китов и SmartMoney: - Джастин Сан, вероятно, продал все свои #EIGEN - участник ICO Ethereum перевёл 6000 #ETH (~14,71 млн $) на Kraken - кит, который получил >32 млн $ прибыли от #ETH с сентября 2023 года, перевёл на Binance 1500 ETH - Animoca Brands внесли на Binance 8 млн #PIXEL - Ceffu вывели 3 372 #BTC (211,33 млн $) с Binance за последние 2 дня 📊Графики и отчёты: - #DOGEдостиг 7-месячного максимума по активности адресов и 4-месячного максимума по транзакциям китов 🐶 - наблюдается всплеск перемещения #BTC на OTC площадки, на которых в настоящее время находится ~410 000 BTC - недельный объем торгов DEX на #SOLпревзошел#ETH впервые за 43 дня - #ARBUniswap: Arbitrum - первый L2, объем свопов которого превысил 200 млрд $ 📈 - ТОП токенов по рыночной капитализации, выпущенных в Q3 2024 года - ТОП проектов по размытой рыночной капитализации (FDV), запущенных в Q3 - ТОП блокчейнов по росту TVL в третьем квартале 2024 года - ТОП лаунчпадов по объему привлеченных средств в Q3 2024 года - отчёт Glassnode ✏️События на завтра: 🔓Разлок: Decentralized Games (#DG) - 2,38% of M.Cap ($113,5m) 🆕#ASI#FET Coinbase International добавит поддержку фьючерсов на Artificial Superintelligence Alliance (ASI) 🍿#AXL Анонс от Axelar 🇪🇺 Services/Composite PMI (сент) - 11:00 МСК - проминфляция PPI (авг) - 12:00 МСК - минутки с прошлого заседания ЕЦБ - 14:30 МСК 🇺🇸 Initial Jobless Claims - 15:30 МСК - S&P Services/Composite PMI (сент) - 16:45 МСК - ISM Services PMI (сент) - 17:00 МСК - Factory Orders (авг) - 17:00 МСК
Пребарај: #staticmethod
@djangoproject · Post #155 · 04.09.2016 г., 12:23
https://anthony-zhang.me/blog/python-bound-methods/ when & why we use @#staticmethod
Hashtags
@djangoproject · Post #593 · 13.04.2018 г., 19:48
@#classmethod vs @#staticmethod vs "plain" methods What's the difference? class MyClass: def method(self): """ Instance methods need a class instance and can access the instance through self. """ return 'instance method called', self @classmethod def classmethod(cls): """ Class methods don't need a class instance. They can't access the instance (self) but they have access to the class itself via cls. """ return 'class method called', cls @staticmethod def staticmethod(): """ Static methods don't have access to cls or self. They work like regular functions but belong to the class's namespace. """ return 'static method called' # All methods types can be # called on a class instance: »> obj = MyClass() »> obj.method() ('instance method called', <MyClass instance at 0x1019381b8>) »> obj.classmethod() ('class method called', <class MyClass at 0x101a2f4c8>) »> obj.staticmethod() 'static method called' # Calling instance methods fails # if we only have the class object: »> MyClass.classmethod() ('class method called', <class MyClass at 0x101a2f4c8>) »> MyClass.staticmethod() 'static method called' »> MyClass.method() TypeError: "unbound method method() must be called with MyClass " "instance as first argument (got nothing instead)"
Hashtags
@djangoproject · Post #385 · 15.07.2017 г., 16:17
# @classmethod vs @staticmethod vs "plain" methods # What's the difference? class MyClass: def method(self): """ Instance methods need a class instance and can access the instance through self. """ return 'instance method called', self @classmethod def classmethod(cls): """ Class methods don't need a class instance. They can't access the instance (self) but they have access to the class itself via cls. """ return 'class method called', cls @staticmethod def staticmethod(): """ Static methods don't have access to cls or self. They work like regular functions but belong to the class's namespace. """ return 'static method called' # All methods types can be # called on a class instance: »> obj = MyClass() »> obj.method() ('instance method called', <MyClass instance at 0x1019381b8>) »> obj.classmethod() ('class method called', <class MyClass at 0x101a2f4c8>) »> obj.staticmethod() 'static method called' # Calling instance methods fails # if we only have the class object: »> MyClass.classmethod() ('class method called', <class MyClass at 0x101a2f4c8>) »> MyClass.staticmethod() 'static method called' »> MyClass.method() TypeError: "unbound method method() must be called with MyClass " "instance as first argument (got nothing instead)" #classmethod#staticmethod
Hashtags
@djangoproject · Post #126 · 31.08.2016 г., 02:13
goo.gl/QkvD2L #staticmethod #Classmethod
Hashtags
@djangoproject · Post #87 · 11.07.2016 г., 11:53
https://docs.python.org/3/library/functions.html#staticmethod #staticmethod(function) Return a #static method for function. A static method does not receive an implicit first argument. To declare a static method, use this idiom: class C: @staticmethod def f(arg1, arg2, ...): ... The @staticmethod form is a function decorator – see the description of function definitions in Function definitions for details. It can be called either on the class (such as C.f()) or on an instance (such as C().f()). The instance is ignored except for its class. Static methods in Python are similar to those found in Java or C++. Also see classmethod() for a variant that is useful for creating alternate class constructors. For more information on static methods, consult the documentation on the standard type hierarchy in The standard type hierarchy. class str(object='') class str(object=b'', encoding='utf-8', errors='strict') Return a str version of object. See str() for details. str is the built-in string class. For general information about strings, see Text Sequence Type — str.
Hashtags