Instance method for converting int to str - str() and __str__()

neubyr neubyr at gmail.com
Sat Oct 3 02:35:28 EDT 2015


I was wondering if there is any resource that explains why certain methods
like str() and type() were implemented the way they are, rather than
.to_string() or .type() instance/object methods.

I find instance/object methods more intuitive for this cases, but I am
wondering why it wasn't implemented it like that.

I know there are equivalents like  __str__() and __class__ , but passing
object to str() or type() seems more popular.

Any resources for reading or some background information would be helpful.

- CS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20151002/31c63642/attachment.html>


More information about the Python-list mailing list