It’s not pretty, but there is a one-liner:
preamble
from collections import namedtuple
import numpy as np
svd = namedtuple('svd', ['U', 'S', 'Vh'])
def mySVD(A):
return svd(*np.linalg.svd(A))
A = np.eye(4)
from operator import attrgetter
U, S, Vh = attrgetter('U', 'S', 'Vh')(mySVD(A))