Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97363 > unrolled thread

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

Started byLaura Creighton <lac@openend.se>
First post2015-10-03 10:31 +0200
Last post2015-10-03 10:31 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Instance method for converting int to str - str() and __str__() Laura Creighton <lac@openend.se> - 2015-10-03 10:31 +0200

#97363 — Re: Instance method for converting int to str - str() and __str__()

FromLaura Creighton <lac@openend.se>
Date2015-10-03 10:31 +0200
SubjectRe: Instance method for converting int to str - str() and __str__()
Message-ID<mailman.357.1443861094.28679.python-list@python.org>
In a message of Fri, 02 Oct 2015 23:35:28 -0700, neubyr writes:
>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
>
>-- 
>https://mail.python.org/mailman/listinfo/python-list
>

start reading here:
https://www.python.org/download/releases/2.2/descrintro/
and keep searching and reading about type-class unification in Python.

The answer is, because types and classes used to be very different
things, and you _couldn't_.

Laura

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web