Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=python.org; s=200901; t=1401133663; bh=3VosJm3VUCUWMwLBMxhS4uXof4YyfbD3ZOtjFy53Bhw=; h=To:From:Subject:Date:References:In-Reply-To:From; b=mdZ2X1pqOcnPH2Gt/COfSdYJbofQA/t2yLACoecWmE7TdpDSEcXajvG1ro9V2n298 kBWy9vw2DfTNpWBSSgCBDhceyAW+30imfNbFzBu2hmuV9X0xu3CptPrl2LbzivjT8C BPUQXnQVt2EErY2fXeU2E7PHk/vd+AcrkhXWPKeI= X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; 'argument': 0.05; 'subject:Python': 0.06; 'string': 0.09; '(aka': 0.09; 'function,': 0.09; 'methods,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'creates': 0.14; 'callable': 0.16; 'chr': 0.16; 'did.': 0.16; 'from:name:christian heimes': 0.16; 'objects.': 0.16; 'ord': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'reedy': 0.16; 'from:addr:python.org': 0.16; 'wrote:': 0.18; "python's": 0.19; 'not,': 0.20; '(the': 0.22; '>>>': 0.22; 'header :User-Agent:1': 0.23; 'adds': 0.24; "aren't": 0.24; 'pass': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'originally': 0.30; 'object.': 0.31; 'class': 0.32; 'lists': 0.32; 'regular': 0.32; 'quite': 0.32; 'subject:the': 0.34; 'false': 0.36; 'method': 0.36; 'christian': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'most': 0.60; 'new': 0.61; 'first': 0.61; 'received:79': 0.64; '500': 0.70; 'object:': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Christian Heimes Subject: Re: confused about the different built-in functions in Python Date: Mon, 26 May 2014 21:47:24 +0200 References: <648e6136a80.00000651codemonkey@inbox.com> <6C977160E42.0000036Ccodemonkey@inbox.com> <87r43gfjqy.fsf@elektro.pacujo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: p4fd2756a.dip0.t-ipconnect.de User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: <87r43gfjqy.fsf@elektro.pacujo.net> X-Enigmail-Version: 1.5.2 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1401133664 news.xs4all.nl 2962 [2001:888:2000:d::a6]:60775 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:72087 On 26.05.2014 21:00, Marko Rauhamaa wrote: > Terry Reedy : > >> 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