@bombs-kim @pf_moore One very neat use-case for this would be in combination with NamedTuple
return types.
Generally speaking, functions that return NamedTuple
seems preferable to those returning regular tuple
, since it is a form of self-documentation. On the other hand, manually writing a NamedTuple
class for every function that returns a tuple is kind of annoying.
In An idea to allow implicit return of NamedTuples It was suggested to introduce some automatism for returning NamedTuple
. I showed here how it could be done with a decorator.
If NamedTuple
return types were more prevalent, this feature would be much more useful for concise unpacking by name. Chris Markiewicz remarked that currently it can be done via
from operator import attrgetter
U, S, Vh = attrgetter('U', 'S', 'Vh')(mySVD(A))