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

TGINSIGHT SIMILAR POSTS

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

Изворен канал @pythonotes · Post #418 · 9 мар.

Оператор pipe позволяет писать более компактный код, реализуя логику объединения данных (Union). Важно помнить, что его поведение зависит от контекста. Побитовые операции (логическое OR) result = 5 | 3 # 5 (0101) | 3 (0011) = 7 (0111) Самое главное - не путать с оператором or, это другое! Объединение множеств set_a = {1, 2, 3} set_b = {3, 4, 5} set_c = set_a | set_b # {1, 2, 3, 4, 5} set_c |= {5, 6} # {1, 2, 3, 4, 5, 6} Слияние словарей dict_1 = {"a": 1, "b": 2} dict_2 = {"b": 3, "c": 4} merged = dict_1 | dict_2 # {'a': 1, 'b': 3, 'c': 4} merged |= {"d": 5} # {'a': 1, 'b': 3, 'c': 4, 'd': 5} Аннотации типов, заменяет Union def process_data(value: int | str) -> None: print(value) Допустимо использовать в isinstance или issubclass isinstance(3, int | float) # True Паттерн-матчинг status_code = 404 match status_code: case 200 | 201 | 204: print("OK") case 400 | 404 | 500: print("ERROR") Для использования в своих классах требуется переопределить метод __or__ Так же нашел библиотеку pipe которая добавляет еще много возможностей. Рекомендую ознакомиться ;) #basic

Hashtags

Резултати

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

Пребарај: #tp6anni

当前筛选 #tp6anni清除筛选
TokenPocket

@tokenpocket_channel · Post #1325 · 16.04.2024 г., 07:14

🎇Happy #TP6Anni!! 💙Join our 6th Anniversary Celebration and win OVER $10,000 Rewards! Dive into👇 https://app.galxe.com/quest/TokenPocket/GCwbMtTHJW 💪We would like to express our gratitude to all TP users and partners, and we hope to work together with you in the future to create a new era of blockchain! ❤️Thank BitlayerLabs, MerlinSwap, cyclenetwork_GO, and TNA_Protocol for supporting the 1st round of the #TP6Anni celebration! Stay tuned for more!

Hashtags

TokenPocket

@tokenpocket_channel · Post #1336 · 07.05.2024 г., 09:27

💙Thanks to all the #TPFam who participated in the #TP6Anni celebration! 🏆Check if you are on the #TP6Anni Giveaway Winner List! 1️⃣ 50 BitlayerLabs Lucky Helmet NFT 👉https://docs.google.com/spreadsheets/d/1qjIkzt1_CM_LfNaoy4vVIrqSmB5hF4oAN5pIScYgeQM/edit#gid=0 2️⃣ $2,000 esMP token Giveaway 👉https://docs.google.com/spreadsheets/d/1tt_AiQmQYZk3EFS-6hEwTZFBI0iTcJDK6YD110TZeQU/edit#gid=0 3️⃣1,000 Piggy Boxes V3 Giveaway 👉https://docs.google.com/spreadsheets/d/1_Aj9cgq0SdyJHQjztl-TWGwHQb_NHgWIbaonwzSH7vA/edit#gid=0 4️⃣$3,000 $TNA and 50 Tapnames Whitelists Giveaway 👉https://docs.google.com/spreadsheets/d/1ZiCOS_nQ897Vj5p5TgoMi607hCCk2IILhwVn6-w-MjE/edit#gid=0 💙Thanks for your participation! If you have any questions, please join https://t.me/tokenPocket_en.

TokenPocket

@tokenpocket_channel · Post #1326 · 17.04.2024 г., 07:02

🎇Happy #TP6Anni!! 💙Join and win 50 BitlayerLabs Lucky Helmet NFT Whitelists Giveaway on Galxe! 👉https://app.galxe.com/quest/TokenPocket/GCddyth8TC 🟧Bitlayer Lucky Helmet is the official NFT launched by BitlayerLabs, a symbol of identity representing the contributions of builders in the Bitlayer community. #TP6Anni#TokenPocket#Bitlayer

TokenPocket

@tokenpocket_channel · Post #1332 · 26.04.2024 г., 08:04

🎇Happy #TP6Anni!! 💙Join and win $2000 esMP Tokens Giveaway on Galxe! 👉https://galxe.com/TokenPocket/campaign/GCyyEths19 🟧MerlinSwap stands as the 1# Decentralized Exchange in the #Bitcoin ecosystem, aimed to become the liquidity hub for BTC and Bitcoin eco-assets, including #BRC20, #BRC420 and native tokens across MerlinLayer2 Bitcoin layer2.