Solved **fields keeps the order of arguments? LILiamByteOP 26 Sep, 23:02 Will valve=2 always come before pressure_kpa=310?
SOSophieDev27 Sep, 07:42 Solutionreplies: 2Yes, since Python 3.7 **kwargs preserves the order in which keyword arguments were passed (and dicts preserve insertion order). So the output order matches the call.
CHCharlieH28 Sep, 18:33Stage 2 unpacking a dict with **reading is how structured logging libraries work under the hood.
Comments 4
Join the discussion CommentAlready have an account? Log in
Yes, since Python 3.7
**kwargspreserves the order in which keyword arguments were passed (and dicts preserve insertion order). So the output order matches the call.Great, the log line stays predictable.
structlog does basically this. Nice to understand the mechanics.
Stage 2 unpacking a dict with
**readingis how structured logging libraries work under the hood.