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


Groups > comp.lang.python > #7309

Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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; 'wed,': 0.03; 'instance': 0.05; 'worse': 0.07; 'append': 0.09; 'line:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'tuple': 0.09; 'def': 0.12; '(name,': 0.16; 'bieber': 0.16; 'declaimed': 0.16; 'element,': 0.16; 'email addr:ix.netcom.com': 0.16; 'email name:wlfraed': 0.16; 'from:addr:ix.netcom.com': 0.16; 'from:addr:wlfraed': 0.16; 'from:name:dennis lee bieber': 0.16; 'hudson': 0.16; 'received:66.245': 0.16; 'received:dsl.mindspring.com': 0.16; 'received:mindspring.com': 0.16; 'received:wlfraed': 0.16; 'replaces': 0.16; 'subject:Objects': 0.16; 'subject:PLEASE': 0.16; 'url:netcom': 0.16; 'url:wlfraed': 0.16; 'wulfraed': 0.16; 'method.': 0.16; 'url:home': 0.25; 'lee': 0.29; 'subject:HELP': 0.29; 'class': 0.29; "won't": 0.30; 'binding': 0.30; 'that...': 0.30; 'header:X -Complaints-To:1': 0.32; 'to:addr:python-list': 0.33; 'list': 0.33; '-0700,': 0.35; 'charset:us-ascii': 0.36; 'created': 0.36; 'received:org': 0.38; 'subject:: ': 0.38; 'called': 0.39; 'header :Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'subject:, ': 0.60; 'your': 0.60; 'dennis': 0.77; '(single': 0.84; 'subject:Methods': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE
Date Thu, 09 Jun 2011 10:25:36 -0700
Organization > Bestiaria Support Staff <
References <mailman.30.1307563778.11593.python-list@python.org> <rqednZoL2ezK8m3QnZ2dnUVZ5hKdnZ2d@giganews.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host user-11fb5d1.dsl.mindspring.com
X-Newsreader Forte Agent 3.3/32.846
X-No-Archive YES
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.56.1307640355.11593.python-list@python.org> (permalink)
Lines 26
NNTP-Posting-Host 82.94.164.166
X-Trace 1307640355 news.xs4all.nl 49178 [::ffff:82.94.164.166]:48324
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7309

Show key headers only | View raw


On Wed, 08 Jun 2011 23:59:35 -0700, Larry Hudson <orgnut@yahoo.com>
declaimed the following in gmane.comp.python.general:

> > class Dog():
> >      def __init__(self, name, breed):
> >          self.name = name
> >          self.breed = breed
> >
> >      def dogAppend(self):
> >          self.dogAppend = []
> >          self.dogAppend.append((self.name,self.breed))
> >          return self.dogAppend
>
 
> 2:  This won't work to append to your list anyway... each time you call dogAppend() it will 
> clear out any existing list and result in a list of one element, a tuple of (name, breed).  You 
> can do exactly the same thing with a single line:  return [(self.name, self.breed)]
>
	Worse than that... The first time dogAppend is called on an instance
of Dog, it replaces the dogAppend method with a binding to the (single
element) list created by the method.
 
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

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


Thread

Of Functions, Objects, and Methods-I NEED HELP PLEASE Cathy James <nambo4jb@gmail.com> - 2011-06-08 15:09 -0500
  Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE John Gordon <gordon@panix.com> - 2011-06-08 20:42 +0000
  Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Larry Hudson <orgnut@yahoo.com> - 2011-06-08 23:59 -0700
    Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Ethan Furman <ethan@stoneleaf.us> - 2011-06-09 05:54 -0700
    Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Ethan Furman <ethan@stoneleaf.us> - 2011-06-09 06:10 -0700
    Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-06-09 10:25 -0700
    Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Larry Hudson <orgnut@yahoo.com> - 2011-06-09 23:07 -0700

csiph-web