Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #72087
| From | Christian Heimes <christian@python.org> |
|---|---|
| Subject | Re: confused about the different built-in functions in Python |
| Date | 2014-05-26 21:47 +0200 |
| References | <648e6136a80.00000651codemonkey@inbox.com> <6C977160E42.0000036Ccodemonkey@inbox.com> <mailman.10353.1401130279.18130.python-list@python.org> <87r43gfjqy.fsf@elektro.pacujo.net> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.10356.1401133664.18130.python-list@python.org> (permalink) |
On 26.05.2014 21:00, Marko Rauhamaa wrote: > Terry Reedy <tjreedy@udel.edu>: > >> Part of the answer is Python's history. Up to about 2.1, most built-in >> types did not have methods, though I know lists did. Ints and strings >> did not, or chr and ord might have been int.chr() and str.ord(). (The >> current string methods were originally functions in the string >> module.) > > Ints still aren't quite like regular objects. For example: > > >>> x = 500 > >>> x.__str__ is x.__str__ > False Just like every other object: >>> class Example(object): pass ... >>> e = Example() >>> e.__str__ is e.__str__ False Python creates a new bound method object every time. A bound method object is a callable object that keeps a strong reference to the function, class and object. The bound method object adds the object as first argument to the function (aka 'self'). Christian
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: confused about the different built-in functions in Python Terry Reedy <tjreedy@udel.edu> - 2014-05-26 14:51 -0400
Re: confused about the different built-in functions in Python Marko Rauhamaa <marko@pacujo.net> - 2014-05-26 22:00 +0300
Re: confused about the different built-in functions in Python Christian Heimes <christian@python.org> - 2014-05-26 21:47 +0200
Re: confused about the different built-in functions in Python Marko Rauhamaa <marko@pacujo.net> - 2014-05-26 23:32 +0300
Re: confused about the different built-in functions in Python Marko Rauhamaa <marko@pacujo.net> - 2014-05-26 23:58 +0300
Re: confused about the different built-in functions in Python Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2014-05-27 11:14 +1200
Re: confused about the different built-in functions in Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-05-27 01:21 +0000
Re: confused about the different built-in functions in Python Terry Reedy <tjreedy@udel.edu> - 2014-05-26 22:00 -0400
csiph-web