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


Groups > comp.lang.python > #91326

Re: should "self" be changed?

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'removes': 0.05; 'method,': 0.07; 'broken.': 0.09; 'convention,': 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; 'spelled': 0.09; 'jan': 0.11; 'wed,': 0.15; 'descriptors': 0.16; 'idlelib': 0.16; 'metaclasses': 0.16; 'parameter,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'wrote:': 0.16; "wouldn't": 0.16; 'removed.': 0.18; 'wednesday': 0.18; 'tests': 0.18; '>>>': 0.20; 'function,': 0.22; 'lawrence': 0.22; 'names.': 0.22; 'nested': 0.22; 'parsing': 0.22; 'am,': 0.23; '2015': 0.23; 'header:In-Reply-To:1': 0.24; 'header :User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'chris': 0.26; "i'm": 0.29; 'looks': 0.29; 'methods.': 0.29; 'relies': 0.29; 'terry': 0.29; 'function': 0.30; 'classes': 0.30; 'source': 0.31; 'code': 0.31; 'class': 0.33; "d'aprano": 0.33; 'steven': 0.33; 'subject:?': 0.34; 'to:addr:python-list': 0.35; 'but': 0.36; 'being': 0.36; 'there': 0.36; 'subject:" ': 0.36; 'subject:: ': 0.37; 'skip:i 20': 0.37; 'signature': 0.37; 'rather': 0.38; 'received:org': 0.38; 'self': 0.38; 'is,': 0.38; 'pm,': 0.39; 'test': 0.39; 'method': 0.39; 'whatever': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'sure': 0.40; 'mark': 0.40; 'apart': 0.70; 'surprise': 0.72; 'subject:self': 0.84; 'received:fios.verizon.net': 0.91
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: should "self" be changed?
Date Wed, 27 May 2015 17:59:08 -0400
References <551c8229-f426-45f0-a0ee-fdad1b161f59@googlegroups.com> <mk2kte$opk$2@speranza.aioe.org> <mailman.64.1432673145.5151.python-list@python.org> <556554d9$0$2796$c3e8da3$76491128@news.astraweb.com> <CAPTjJmpZ3Tc1TBa5TokC+P8YLRs2jxAykPJxO7fUKwb9tvpiGQ@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-98-114-97-173.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To <CAPTjJmpZ3Tc1TBa5TokC+P8YLRs2jxAykPJxO7fUKwb9tvpiGQ@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.101.1432763977.5151.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432763977 news.xs4all.nl 2839 [2001:888:2000:d::a6]:34762
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91326

Show key headers only | View raw


On 5/27/2015 2:32 AM, Chris Angelico wrote:
> On Wed, May 27, 2015 at 3:23 PM, Steven D'Aprano
> <steve+comp.lang.python@pearwood.info> wrote:
>> On Wednesday 27 May 2015 06:45, Mark Lawrence wrote:
>>
>>> Apart from breaking all the tools that rely on "self" being spelt "self"
>>> this looks like an excellent idea.
>>
>> Tools which rely on self being spelled "self" are already broken. It's a
>> convention, nothing more, and there are various good reasons for breaking
>> the convention:
>>
>> - metaclasses
>> - classmethods
>> - custom descriptors
>> - nested classes
>
> If it truly relies on it, yes. But if I see a function that has "self"
> as its first parameter, I'm going to read it as a (probable) method
> rather than a stand-alone function, and it wouldn't surprise me if
> introspection and/or source code parsing made the same assumption.

The Idlelib calltips function does not look at names.  It leaves the 
signature of functions as is and removes the first name, whatever it is, 
of bound methods, including bound class methods.  See 
idlelib.CallTips.get_argspec for details. To make sure there is no name 
assumption, test_calltips.py tests that the first name, not 'self', is 
the name removed.  One test method, Tc.t6, has function signature "(no, 
self)", which makes the bound method signature "(self)".


-- 
Terry Jan Reedy

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

should "self" be changed? zipher <dreamingforward@gmail.com> - 2015-05-26 09:37 -0700
  Re: should "self" be changed? Laura Creighton <lac@openend.se> - 2015-05-26 18:57 +0200
    Re: should "self" be changed? zipher <dreamingforward@gmail.com> - 2015-05-26 20:01 -0700
    Re: should "self" be changed? zipher <dreamingforward@gmail.com> - 2015-05-26 20:15 -0700
  Re: should "self" be changed? Laurent Pointal <laurent.pointal@free.fr> - 2015-05-26 18:59 +0200
  Re: should "self" be changed? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-26 18:28 +0100
    Re: should "self" be changed? zipher <dreamingforward@gmail.com> - 2015-05-26 19:48 -0700
      Re: should "self" be changed? zipher <dreamingforward@gmail.com> - 2015-05-26 20:17 -0700
        Re: should "self" be changed? Ben Finney <ben+python@benfinney.id.au> - 2015-05-27 14:39 +1000
          Re: should "self" be changed? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-27 15:47 +1000
            Re: should "self" be changed? Ben Finney <ben+python@benfinney.id.au> - 2015-05-27 21:29 +1000
              Re: should "self" be changed? zipher <dreamingforward@gmail.com> - 2015-05-27 05:40 -0700
                Re: should "self" be changed? Todd <toddrjen@gmail.com> - 2015-05-27 15:00 +0200
                Re: should "self" be changed? Grant Edwards <invalid@invalid.invalid> - 2015-05-27 14:19 +0000
                Re: should "self" be changed? zipher <dreamingforward@gmail.com> - 2015-05-30 16:18 -0700
            Re: should "self" be changed? zipher <dreamingforward@gmail.com> - 2015-05-30 16:10 -0700
          Re: should "self" be changed? zipher <dreamingforward@gmail.com> - 2015-05-30 16:13 -0700
  Re: should "self" be changed? Chris Angelico <rosuav@gmail.com> - 2015-05-27 03:31 +1000
  Re: should "self" be changed? random832@fastmail.us - 2015-05-26 14:11 -0400
  Re: should "self" be changed? Marko Rauhamaa <marko@pacujo.net> - 2015-05-26 22:46 +0300
    Re: should "self" be changed? Ned Batchelder <ned@nedbatchelder.com> - 2015-05-26 13:04 -0700
      Re: should "self" be changed? Marko Rauhamaa <marko@pacujo.net> - 2015-05-26 23:36 +0300
        Re: should "self" be changed? Anssi Saari <as@sci.fi> - 2015-05-28 17:07 +0300
          Re: should "self" be changed? Marko Rauhamaa <marko@pacujo.net> - 2015-05-28 18:01 +0300
            Re: should "self" be changed? Ian Kelly <ian.g.kelly@gmail.com> - 2015-05-28 09:40 -0600
              Re: should "self" be changed? Marko Rauhamaa <marko@pacujo.net> - 2015-05-28 19:59 +0300
                Re: should "self" be changed? Chris Angelico <rosuav@gmail.com> - 2015-05-29 03:06 +1000
                Re: should "self" be changed? zipher <dreamingforward@gmail.com> - 2015-05-30 16:39 -0700
            Re: should "self" be changed? Steven D'Aprano <steve@pearwood.info> - 2015-05-29 12:00 +1000
              Re: should "self" be changed? Steven D'Aprano <steve@pearwood.info> - 2015-05-29 15:46 +1000
              Re: should "self" be changed? Steven D'Aprano <steve@pearwood.info> - 2015-06-03 02:50 +1000
                Re: should "self" be changed? "Dr. BigCock" <dreamingforward@gmail.com> - 2015-06-02 10:16 -0700
                Re: should "self" be changed? Marko Rauhamaa <marko@pacujo.net> - 2015-06-02 20:19 +0300
                Re: should "self" be changed? "Dr. Bigcock" <dreamingforward@gmail.com> - 2015-06-02 11:02 -0700
                Re: should "self" be changed? Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-02 19:39 -0600
                Re: should "self" be changed? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-03 17:05 +1000
    Re: should "self" be changed? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-27 15:20 +1000
  Re: should "self" be changed? garabik-news-2005-05@kassiopeia.juls.savba.sk - 2015-05-26 20:26 +0000
    Re: should "self" be changed? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-26 21:45 +0100
      Re: should "self" be changed? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-27 15:23 +1000
        Re: should "self" be changed? Chris Angelico <rosuav@gmail.com> - 2015-05-27 16:32 +1000
          Re: should "self" be changed? Marko Rauhamaa <marko@pacujo.net> - 2015-05-27 10:39 +0300
            Re: should "self" be changed? Chris Angelico <rosuav@gmail.com> - 2015-05-27 18:20 +1000
            Re: should "self" be changed? zipher <dreamingforward@gmail.com> - 2015-05-30 16:15 -0700
        Re: should "self" be changed? Terry Reedy <tjreedy@udel.edu> - 2015-05-27 17:59 -0400
    Re: should "self" be changed? Vito De Tullio <vito.detullio@gmail.com> - 2015-05-26 23:17 +0200
    Re: should "self" be changed? Tim Chase <python.list@tim.thechases.com> - 2015-05-26 16:10 -0500
  Re: should "self" be changed? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-27 15:17 +1000

csiph-web