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

Резултати

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

Пребарај: #sheep

当前筛选 #sheep清除筛选
全民头条吃瓜

@xinwenchigua8 · Post #66778 · 11.05.2026 г., 14:39

四百块钱,真不贵。。。 8日,新疆伊犁,拉那提景区。。游客带的阿拉斯加犬把小羊咬了,主人赔了四百块钱把羊买下来了。。。 现在好了,不光要养狗,还得养只羊了 #阿拉斯加犬#羊 Four hundred yuan, not expensive at all... On the 8th, in Lanati Scenic Area, Yili, Xinjiang... A tourist's Alaskan Malamute bit a lamb, and the owner paid four hundred yuan to buy it back... Now, not only do you have to keep a dog, you also have to keep a sheep. #AlaskanMala#Sheep

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40711 · 27.02.2026 г., 15:02

Sheep can recognize and remember faces. They can remember 50 sheep faces over two years and at least 10 human faces. They look at outside features first, then focus on eyes, nose, and mouth when familiar. If a sheep stares, it might be memorizing your face! 🐑🧠 @googlefactss #Sheep#SmartAnimals#Faces#Memory#Animals

Google Facts™ [ ️@googlefactss🌎]

@googlefactss · Post #40739 · 05.03.2026 г., 15:01

Sheep can feel emotions like fear, anger, boredom, and happiness. They evaluate their surroundings using checks like suddenness, familiarity, predictability, and control, similar to humans. Sudden events can cause fear, while predictable environments may lead to boredom. 🐑⚽️ @googlefactss #AnimalWelfare#Sheep#Emotions#AnimalCare#Nature

12
ПретходнаСтраница 1 од 2Следна