Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97363
| From | Laura Creighton <lac@openend.se> |
|---|---|
| Subject | Re: Instance method for converting int to str - str() and __str__() |
| References | <CALFxCvyGUC+Sz+d23hNAv6HnFeZKEFdAexZFC9Uj3T3vHyYLtQ@mail.gmail.com> |
| Date | 2015-10-03 10:31 +0200 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.357.1443861094.28679.python-list@python.org> (permalink) |
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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Instance method for converting int to str - str() and __str__() Laura Creighton <lac@openend.se> - 2015-10-03 10:31 +0200
csiph-web