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


Groups > comp.lang.python > #17251

Re: AttributeError in "with" statement (3.2.2)

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'context': 0.04; 'attribute': 0.07; 'terry': 0.07; 'python': 0.08; '>>>>': 0.09; 'defined.': 0.09; 'from:addr:python': 0.09; 'parameter.': 0.09; 'am,': 0.12; 'definition,': 0.16; 'definition.': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'manager)': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'reedy': 0.16; 'reply-to:addr:python- list': 0.16; 'wed,': 0.17; 'wrote:': 0.18; '>>>': 0.18; 'instance': 0.18; 'purposes,': 0.18; 'dec': 0.22; 'header:In- Reply-To:1': 0.22; 'statement': 0.23; 'body.': 0.23; 'fine,': 0.23; 'defined': 0.24; 'says': 0.25; 'saying': 0.26; "i'm": 0.26; 'function': 0.27; 'subject:" ': 0.28; 'bit': 0.28; 'class': 0.29; 'correct': 0.29; 'definition': 0.30; '(the': 0.30; 'header:User- Agent:1': 0.33; 'actually': 0.33; 'there': 0.33; 'to:addr:python- list': 0.34; 'eric': 0.34; 'received:84': 0.34; 'too': 0.34; 'anything': 0.34; 'reply-to:addr:python.org': 0.34; 'subject:with': 0.36; 'but': 0.37; 'except': 0.37; 'technical': 0.37; 'think': 0.37; 'cases,': 0.38; 'steven': 0.38; 'created': 0.38; 'subject: (': 0.40; 'to:addr:python.org': 0.40; '2011': 0.61; 'covers': 0.64; 'birth': 0.67; 'header:Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'below:': 0.80; '-0500,': 0.84; 'naked': 0.91; 'live.': 0.95
X-CM-Score 0.00
X-CNFS-Analysis v=2.0 cv=J8QoHXbS c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=9jsOeB20M3cA:10 a=pZbEeqlyqr0A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=hpdPqvloxCKxfb4ujJEA:9 a=wPNLvfGTeEIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117
X-AUTH mrabarnett:2500
Date Thu, 15 Dec 2011 05:15:58 +0000
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version 1.0
To python-list@python.org
Subject Re: AttributeError in "with" statement (3.2.2)
References <b8092181-c306-40bc-a07a-bb35bc925cf1@18g2000prn.googlegroups.com> <CALFfu7BwozUsp=WB1+66wH9RR1=DQCAprNve7N+LFR2ptGMFWg@mail.gmail.com> <mailman.3626.1323844169.27778.python-list@python.org> <4ee857d4$0$11091$c3e8da3@news.astraweb.com> <mailman.3659.1323904439.27778.python-list@python.org> <4ee97f20$0$11091$c3e8da3@news.astraweb.com>
In-Reply-To <4ee97f20$0$11091$c3e8da3@news.astraweb.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To python-list@python.org
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.3663.1323926134.27778.python-list@python.org> (permalink)
Lines 34
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1323926134 news.xs4all.nl 6848 [2001:888:2000:d::a6]:58149
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:17251

Show key headers only | View raw


On 15/12/2011 05:01, Steven D'Aprano wrote:
> On Wed, 14 Dec 2011 18:13:36 -0500, Terry Reedy wrote:
>
>>  On 12/14/2011 3:01 AM, Steven D'Aprano wrote:
>>>  On Wed, 14 Dec 2011 01:29:13 -0500, Terry Reedy wrote:
>>>
>>>>  To complement what Eric says below: The with statement is looking for
>>>>  an instance *method*, which by definition, is a function attribute of
>>>>  a *class* (the class of the context manager) that takes an instance of
>>>>  the class as its first parameter.
>>>
>>>  I'm not sure that is correct... I don't think that there is anything
>>>  "by definition" about where methods live.
>>
>>    From the Python glossary:
>>  "method: A function which is defined inside a class body."
>>
>>  That is actually a bit too narrow, as a function can be added to the
>>  class after it is defined. But the point then is that it is treated as
>>  if defined inside the class body.
>
> First off, let me preface this by saying that I'm not necessarily saying
> that the above glossary definition needs to be changed. For most
> purposes, it is fine, since *nearly always* methods are created as
> functions defined inside the class body. But it needs to be understood in
> context as a simplified, hand-wavy definition which covers 99% of the
> common cases, and not a precise, definitive technical definition.
>
> To give an analogy, it is like defining mammals as "hairy animals which
> give birth to live young", which is correct for all mammals except for
> monotremes, which are mammals which lay eggs.
>
[snip]
Or the naked mole-rat. Or cetaceans (whales).

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


Thread

AttributeError in "with" statement (3.2.2) Steve Howell <showell30@yahoo.com> - 2011-12-13 21:42 -0800
  Re: AttributeError in "with" statement (3.2.2) Eric Snow <ericsnowcurrently@gmail.com> - 2011-12-13 23:05 -0700
  Re: AttributeError in "with" statement (3.2.2) Terry Reedy <tjreedy@udel.edu> - 2011-12-14 01:29 -0500
    Re: AttributeError in "with" statement (3.2.2) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-14 08:01 +0000
      Re: AttributeError in "with" statement (3.2.2) 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-14 08:08 -0800
        Re: AttributeError in "with" statement (3.2.2) 88888 Dihedral <dihedral88888@googlemail.com> - 2011-12-14 08:28 -0800
      Re: AttributeError in "with" statement (3.2.2) Steve Howell <showell30@yahoo.com> - 2011-12-14 09:16 -0800
      Re: AttributeError in "with" statement (3.2.2) Terry Reedy <tjreedy@udel.edu> - 2011-12-14 18:13 -0500
        Re: AttributeError in "with" statement (3.2.2) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-15 05:01 +0000
          Re: AttributeError in "with" statement (3.2.2) MRAB <python@mrabarnett.plus.com> - 2011-12-15 05:15 +0000
            Re: AttributeError in "with" statement (3.2.2) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-15 07:21 +0000
            Re: AttributeError in "with" statement (3.2.2) Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-12-16 09:34 +1300
          Re: AttributeError in "with" statement (3.2.2) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-15 07:47 +0000
          Re: AttributeError in "with" statement (3.2.2) Steve Howell <showell30@yahoo.com> - 2011-12-15 05:35 -0800
            Re: AttributeError in "with" statement (3.2.2) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-16 03:34 +0000
          Re: AttributeError in "with" statement (3.2.2) Terry Reedy <tjreedy@udel.edu> - 2011-12-15 19:39 -0500
            Re: AttributeError in "with" statement (3.2.2) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-16 09:22 +0000
              Re: AttributeError in "with" statement (3.2.2) Terry Reedy <tjreedy@udel.edu> - 2011-12-16 17:05 -0500
                Re: AttributeError in "with" statement (3.2.2) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-17 01:26 +0000
                Re: AttributeError in "with" statement (3.2.2) Terry Reedy <tjreedy@udel.edu> - 2011-12-17 21:09 -0500
              Re: AttributeError in "with" statement (3.2.2) Ethan Furman <ethan@stoneleaf.us> - 2011-12-16 15:26 -0800
                Re: AttributeError in "with" statement (3.2.2) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-12-17 03:05 +0000
              Re: AttributeError in "with" statement (3.2.2) Ethan Furman <ethan@stoneleaf.us> - 2011-12-16 16:34 -0800
  Re: AttributeError in "with" statement (3.2.2) Peter Otten <__peter__@web.de> - 2011-12-14 11:02 +0100
  Re: AttributeError in "with" statement (3.2.2) Eric Snow <ericsnowcurrently@gmail.com> - 2011-12-14 09:56 -0700
  Re: AttributeError in "with" statement (3.2.2) Lie Ryan <lie.1296@gmail.com> - 2011-12-15 06:14 +1100
  Re: AttributeError in "with" statement (3.2.2) Eric Snow <ericsnowcurrently@gmail.com> - 2011-12-14 12:46 -0700

csiph-web