I’m looking for what is the most idiomatic way of naming a method that for instance converts the data of a class to xml.
If I were doing this in Ruby I would make a method named to_xml for instance, but I’ve seen several different ways of doing this in Python. toxml, to_xml, xml and toXML, for different outputs than XML, but just extrapolating what it would look like for XML.
And taken how you convert objects for native Python objects (str() etc) I don’t really know what would be the idiomatic way.
Personally I would just continue and use to_xml since that’s what I’m used to, but would that be unexpected to an experienced Python programmer?
PEP8 recommends
to_xml: