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

Резултати

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

Пребарај: #single

当前筛选 #single清除筛选
Андрей Лаупер

@free4ones · Post #545 · 29.08.2024 г., 06:24

📻 Годы работы в эфире музыкальных радиостанций не проходят бесследно - тяга к микрофону и к свежим реализам не исчезает😎 💿 Свежий летний попсовый сингл из чарта UK TOP 40: Fred again.. / Anderson .Paak / CHIKA - Places To Be Британцы в очередной раз удивляют своей прогрессивностью и технологичным продакшном. #single#summer

探索号

@seeker_rc · Post #19839 · 07.05.2026 г., 03:25

大家是怎么管理和检索 SingleFile 保存的网页的? 长期都是用 single file 保存网页,但发现自己想用的时候,却始终找不到自己保存,目前想到的解决方案是自动 rag 清洗检索,但总觉得这玩意儿之前应该有人做过了吧 via V2EX 分享创造 标签: #网页#SingleFile#single ⚡️探索号频道 ⚡️探索者频道 ⚡️探索者交流群 ⚡️ Youtube 频道:科技探索者 每天推荐有趣内容,欢迎订阅、转发。

djangoproject

@djangoproject · Post #107 · 02.08.2016 г., 15:22

https://github.com/python/asyncio The #asyncio#module provides infrastructure for writing #single-threaded concurrent code using #coroutines, #multiplexing#I/O access over sockets and other resources, running network clients and servers, and other related primitives. Here is a more detailed list of the package contents: a pluggable event loop with various system-specific implementations; transport and protocol abstractions (similar to those in Twisted); concrete support for TCP, UDP, SSL, subprocess pipes, delayed calls, and others (some may be system-dependent); a Future class that mimics the one in the concurrent.futures module, but adapted for use with the event loop; #coroutines and #tasks based on yield from (PEP 380), to help write concurrent code in a sequential fashion; cancellation support for Futures and coroutines; synchronization primitives for use between coroutines in a single thread, mimicking those in the #threading module; an interface for passing work off to a threadpool, for times when you absolutely, positively have to use a library that makes blocking I/O calls. Note: The implementation of asyncio was previously called "Tulip".

Desi Memes Funny Jokes

@DESI_MEMES_Funny_Jokes · Post #6008 · 10.12.2024 г., 12:03

. . . . . #crusheverything#crush#crushlovers#sendthistoyourcrush#crushmemes#crushrejection#crush😍#crushquote#love#lovecrush#singlelifeproblems#singlefriends#singleme#singlelifebelike#singlemen#singleboy#single#boyswillbeboys#boystory#boysdream#boyslife#boyscanrelate#relatable#relatablememes#reelsinstagram#reelfeelit#explore#exploremoretogether

Desi Memes Funny Jokes

@DESI_MEMES_Funny_Jokes · Post #5425 · 12.10.2024 г., 05:03

Earphone laga lena bhai 🎧 . #crusheverything#crush#crushlovers#sendthistoyourcrush#crushmemes#crushrejection#crush😍#crushquote#love#lovecrush#singlelifeproblems#singlefriends#singleme#singlelifebelike#singlemen#singleboy#single#boyswillbeboys#boystory#boysdream#boyslife#boyscanrelate#relatable#relatablememes#reelinstagram#reelfeelit#explore#exploremore