Д
Не красивее ли вот так написать ?
value, error = get_something()
Size: a a a
Д
DB
value = error = get_something() # Union[Value, Exception]vs
if isinstance(error, Exception):
raise error # Exception
return value # Union[Value, Exception]
value_or_error = get_something() # Union[Value, Exception]
if isinstance(value_or_error, Exception):
raise value_or_error # Exception
return value_or_error # Value
DB
Б
E
Б
DB
E
E
ED
value = error = get_something() # Union[Value, Exception]vs
if isinstance(error, Exception):
raise error # Exception
return value # Union[Value, Exception]
value_or_error = get_something() # Union[Value, Exception]
if isinstance(value_or_error, Exception):
raise value_or_error # Exception
return value_or_error # Value
val, err = do_something()
if err is not None:
return None, err
return do_something_more(val)
E
val, err = do_something()
if err is not None:
return None, err
return do_something_more(val)
А4
OY
if __name__ == '__main__':
есть в главном файле?А4
if __name__ == '__main__':
есть в главном файле?OY
А4
А4