How to call variables after type conversion?
Let’s say we’ve got a Card object with attributes .rank and .suit: card = Card(K, hearts)
.
Now I’m converting it to a dictionary: card_dict = some_conversion_function(card)
, where card_dict = {“rank”: K, “suit”: hearts}.
The name card_dict does not feel very clean. Type conversions should be relatively common though, so I expect there is a convention for naming them.
In this case the context is that card_dict will be used to send the information over a socket.
I’ve googled for stuff like “python type conversion naming convention” which does not yield any relevant results.
https://peps.python.org/pep-0008/#descriptive-naming-styles
also does not treat this particular case.
A similar C# thread says to name it “card_as_dict”: How do I name the same variable but of different type