The general idea is to make an OrderedDict first and pass this to the function, however this looks messy. There's a lot of suggestions on making **kwargs ordered, but this seems to be the only solution - In Python, what determines the order while iterating through kwargs?
However, I'm wondering is it possible to use a few python features to allow a simple input? So myFunction( a=5, c=2, b=3 ) will keep the order, without having to wrap the inside values in an OrderedDict.
Here's some code which won't work but it's the idea I have and don't know how to implement
class testing:
def __init__( self, kwargs ):
print kwargs
testing2 = testing( OrderedDict( valueToInput ) )
testing2( a=5, c=2, b=3 )
Would it be possible at all? If there is such a way to do what I did with the testing2 value, that'd be really useful for other purposes too.