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

Резултати

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

Пребарај: #voyager1

当前筛选 #voyager1清除筛选
Russia News

@Russiaanews · Post #50984 · 24.04.2026 г., 17:01

Зонд Voyager 1: На пороге межзвездного пути 🔭 Космический зонд Voyager 1, запущенный в 1977 году, приближается к значимой вехе. К 13 ноября 2026 года он станет первым созданным человеком объектом, удалившимся от Земли на один световой день. На данный момент до него 23 световых часа. Voyager 1 все еще отправляет научные данные, несмотря на постепенное отключение приборов. Хотя качество работы приближается к завершению, ожидается, что зонд будет функционировать до 30-х годов, продолжая свой путь к звездам, неся записи человечества в надежде на встречу с иной цивилизацией. #космос#Voyager1 Russia News — Подпишись

Universe Mysteries 🪐

@cosmomyst · Post #614 · 10.01.2026 г., 22:21

🪐 It takes the Voyager 1 spacecraft, humanity’s most distant probe, over 19 hours just for a radio signal to travel the 24 billion kilometers between it and Earth—showing how even within our own solar neighborhood, space distances make communication a true journey through time. Each moment spent waiting for a reply from Voyager 1 is a reminder of just how vast the spaces between worlds and stars really are. ✨ #spacedistances⚡#voyager1⚡#solarystem⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries 👉more Channels ​

Universe Mysteries 🪐

@cosmomyst · Post #287 · 17.09.2025 г., 20:11

🪐 The Voyager 1 spacecraft, launched in 1977, is now traveling through interstellar space—over 24 billion kilometers from Earth—and still sends back data to NASA. As humanity’s farthest-reaching probe, Voyager 1’s journey shows how crossing the vast boundary beyond our solar system is possible, though current speeds mean that reaching even the nearest star system like Alpha Centauri would take more than 70,000 years with similar technology. ✨ #Voyager1⚡#interstellar⚡#travel⚡#spaceflight⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space 👉subscribe Universe Mysteries ​