@AiGenLabsStyles · Post #255 · 22.07.2024 г., 09:14
◀️--sref 695992723 #Surreal#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎
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
Пребарај: #detailed
@AiGenLabsStyles · Post #255 · 22.07.2024 г., 09:14
◀️--sref 695992723 #Surreal#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎
@AiGenLabsStyles · Post #681 · 05.09.2024 г., 07:12
⭐️ --sref 702143375 #Dark#Surreal#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ 👥TheLab - our community 🔥AiGenLabs - main channel
@AiGenLabsStyles · Post #392 · 03.08.2024 г., 06:55
◀️--sref 4275140477 --s 333 🟥 🟥 #Dark#Photography#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎
@AiGenLabsStyles · Post #458 · 12.08.2024 г., 11:18
◀️--sref 3264171648 --s 222 🟥 #Photography#Vibrant#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎
@AiGenLabsStyles · Post #275 · 24.07.2024 г., 08:13
◀️--sref 999999 --s 444 #Cinematic#Dark#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎
@AiGenLabsStyles · Post #170 · 13.07.2024 г., 06:11
◀️--sref 401556869 --s 400🟥 #Cinematic#Detailed#Dark#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎
@AiGenLabsStyles · Post #445 · 10.08.2024 г., 11:18
◀️--sref 2010239734 --s 350 🟥 #Dark#3D#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎
@AiGenLabsStyles · Post #140 · 10.07.2024 г., 08:13
◀️--sref 1909266816 #3d#Dark#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎
@AiGenLabsStyles · Post #96 · 03.07.2024 г., 06:11
◀️--sref 3864191587 🟥 #3D#Dark#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎
@AiGenLabsStyles · Post #234 · 19.07.2024 г., 08:13
◀️--sref 3709133334 --s 300 🟥 #Photography#Cinematic#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎
@AiGenLabsStyles · Post #100 · 03.07.2024 г., 10:15
◀️--sref 3829504366 #2D#Vibrant#Detailed#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎
@AiGenLabsStyles · Post #339 · 30.07.2024 г., 08:13
◀️--sref 3451403884 --s 250 #Photography#Detailed#Vintage#StyleRandom#MidJourney#AiGenLabs#Ai 〰️〰️〰️〰️〰️ main channel📎