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


Groups > comp.lang.python > #17163

Re: Overriding a global

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.chainon-marquant.org!news-transit.tcx.org.uk!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'attributes': 0.05; 'attribute': 0.07; 'difference,': 0.09; 'subclasses': 0.09; 'api': 0.09; 'am,': 0.12; 'attribute,': 0.16; 'cc:addr:benfinney.id.au': 0.16; 'cc:name:ben finney': 0.16; 'guilty': 0.16; 'subject:Overriding': 0.16; 'subject:global': 0.16; 'cc:addr :python-list': 0.16; 'meant': 0.17; 'wrote:': 0.18; 'functions,': 0.18; 'cc:no real name:2**0': 0.20; "aren't": 0.21; 'dec': 0.22; '(or': 0.22; 'header:In-Reply-To:1': 0.22; 'replacing': 0.23; 'code': 0.25; 'saying': 0.26; 'code.': 0.26; "i'm": 0.26; 'code,': 0.27; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'class': 0.29; 'does': 0.32; 'tue,': 0.32; 'received:209.85.161.46': 0.32; 'received:mail- fx0-f46.google.com': 0.32; 'there': 0.33; 'external': 0.35; 'received:209.85.161': 0.36; 'uses': 0.36; 'cc:2**1': 0.36; 'variables': 0.37; 'received:google.com': 0.37; 'another': 0.37; 'accepted': 0.38; 'received:209.85': 0.38; 'either': 0.39; 'should': 0.39; 'extend': 0.39; 'received:209': 0.40; '2011': 0.61; 'order': 0.62; 'due': 0.66; 'claim': 0.76; 'hand,': 0.76; 'expectations': 0.77; 'confusion.': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=K9jgqLv8YIuS9439nIiovo8yPm3Ogrq34dr/3uwocmI=; b=rYzZPslGi0/mrB4n16cYDMvnJeDQbDAvWrCUEXfeQmo5xgKVyJISes0zJcXU5z2vwf 0+tWiPwoeLNI5JQ+P78730A9J4lja/mnGsqM5r3ADLqZwnnaHRcjtZpeu2ontvefYXTu Q4BbqU28VW6uB1PgfxGyrxKzoj7QBenqlolYo=
MIME-Version 1.0
In-Reply-To <CAN1F8qX_O1oh-f_VcyA-ZhgfyNWFWFLUATvRQzvmEpfhRNJ_OA@mail.gmail.com>
References <roy-B236C9.15475310122011@news.panix.com> <mailman.3500.1323551240.27778.python-list@python.org> <roy-EC9997.16105310122011@news.panix.com> <mailman.3542.1323688423.27778.python-list@python.org> <4ee671f6$0$29979$c3e8da3$5496439d@news.astraweb.com> <mailman.3569.1323726243.27778.python-list@python.org> <87k4611l4y.fsf@benfinney.id.au> <CAN1F8qWYRSq0oUTzeDn-+SYXdHr7+akAQPSk-R+90Ax7E1FAZQ@mail.gmail.com> <CALwzidngv952LTEguRcP9Pj3_-tZTNpqvqkjcid5sje63N8hkg@mail.gmail.com> <CAN1F8qX_O1oh-f_VcyA-ZhgfyNWFWFLUATvRQzvmEpfhRNJ_OA@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 13 Dec 2011 12:34:41 -0700
Subject Re: Overriding a global
To Joshua Landau <joshua.landau.ws@gmail.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org, Ben Finney <ben+python@benfinney.id.au>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3615.1323804914.27778.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1323804914 news.xs4all.nl 6976 [2001:888:2000:d::a6]:47252
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17163

Show key headers only | View raw


On Tue, Dec 13, 2011 at 1:34 AM, Joshua Landau
<joshua.landau.ws@gmail.com> wrote:
>> No, there is another difference, the reason for rebinding the name.
>> In a subclass, you would rebind a class attribute because that
>> particular attribute, which you need to change, is used and expected
>> by external code, either in the base class or in code that uses its
>> API (or both).  Local variables in functions, on the other hand, are
>> not externally visible, so there is no need to do this in order to
>> conform to the expectations of external code.  All it does in that
>> case is to sow potential confusion.
>>
> So you're saying you should never extend methods or attributes that
> aren't meant to be used as part of of the API? Because I can claim
> guilty on this point.

No, I'm only saying that replacing attributes in subclasses is
accepted because it is necessary due to external dependencies, and
that local variables in functions don't have that excuse.

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


Thread

Overriding a global Roy Smith <roy@panix.com> - 2011-12-10 15:47 -0500
  Re: Overriding a global MRAB <python@mrabarnett.plus.com> - 2011-12-10 21:07 +0000
    Re: Overriding a global Roy Smith <roy@panix.com> - 2011-12-10 16:10 -0500
      Re: Overriding a global Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-12 12:13 +0100
        Re: Overriding a global Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-12 21:28 +0000
          Re: Overriding a global Dave Angel <d@davea.name> - 2011-12-12 16:43 -0500
            Re: Overriding a global Ben Finney <ben+python@benfinney.id.au> - 2011-12-13 09:27 +1100
              Re: Overriding a global Dave Angel <d@davea.name> - 2011-12-12 20:46 -0500
              Re: Overriding a global Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-13 01:48 +0000
              Re: Overriding a global Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-12 22:50 -0700
              Re: Overriding a global Joshua Landau <joshua.landau.ws@gmail.com> - 2011-12-13 08:34 +0000
              Re: Overriding a global Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-13 12:34 -0700
              Re: Overriding a global Ian Kelly <ian.g.kelly@gmail.com> - 2011-12-13 12:54 -0700
          Re: Overriding a global Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-13 10:54 +0100
            Re: Overriding a global Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-13 11:15 +0000
              Re: Overriding a global Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-13 14:30 +0100
              Re: Overriding a global Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-14 11:14 +0100
              Re: Overriding a global Chris Angelico <rosuav@gmail.com> - 2011-12-14 21:32 +1100
              Re: Overriding a global Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-14 13:05 +0100
                Re: Overriding a global Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-14 12:53 +0000
                Re: Overriding a global Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-14 14:35 +0100
              Re: Overriding a global Chris Angelico <rosuav@gmail.com> - 2011-12-14 23:21 +1100
              Re: Overriding a global Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-12-14 18:06 +0100
  Re: Overriding a global Terry Reedy <tjreedy@udel.edu> - 2011-12-10 19:14 -0500
  Re: Overriding a global Terry Reedy <tjreedy@udel.edu> - 2011-12-10 19:19 -0500
  Re: Overriding a global Peter Otten <__peter__@web.de> - 2011-12-11 09:14 +0100
  Re: Overriding a global Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2011-12-13 10:15 +0100

csiph-web