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


Groups > comp.lang.python > #7886

Re: What's the best way to write this base class?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.027
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'override': 0.07; 'pm,': 0.10; 'received:209.85.214.174': 0.14; 'received:mail- iw0-f174.google.com': 0.14; 'wrote:': 0.14; '2:17': 0.16; 'character:': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'model.': 0.16; '\xa0def': 0.16; 'header:In- Reply-To:1': 0.21; 'expect': 0.25; 'message-id:@mail.gmail.com': 0.28; 'received:209.85.214': 0.28; 'sat,': 0.29; 'subject:?': 0.29; 'class': 0.29; 'to:addr:python-list': 0.33; 'subject:What': 0.35; 'received:google.com': 0.37; 'received:209.85': 0.37; 'subject:: ': 0.38; "i'd": 0.39; 'received:209': 0.39; 'to:addr:python.org': 0.39; 'john': 0.62; 'subject:this': 0.76; 'subject:class': 0.84; 'subject:write': 0.84; 'subject:best': 0.93
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=zofM/zcAGbvbD8FUhx/OLyxXeFhdEIMtPIwfwsX/r1o=; b=T1gp3998VOuyvTjMthkg+3ilEran4dw8N0vMtu/tI36/8/0GeyjmkEbecn7NiK/fZf EHWoqGnye21PP7kpBLfAr7K6wRwGyJ81pIfvrDyT3dEuxUKi5FTgSiDWiREzy7u5YZKz 9nxH9oXMtGbF3/QETpz36V/yajXWrblReha+c=
DomainKey-Signature a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=q4JDNbKRw7/dKPVmDWrk1eZArs8amo+Yo7Hsg0B+Sj0JXZFymegcWzwM5hP4FhIR6U uYT1Tthogie/VzN+9kB0JGqTy7gVtbDy/BtqRJavOvcV5UKkU4AoNt5SNClvA2ilwzzV gWEdXTLtjAE3FEAERva3TB3nfQGG1xYM6sajI=
MIME-Version 1.0
In-Reply-To <142e76c3-b304-43ef-af24-919fa6146369@c9g2000yqp.googlegroups.com>
References <142e76c3-b304-43ef-af24-919fa6146369@c9g2000yqp.googlegroups.com>
Date Sat, 18 Jun 2011 14:53:50 +1000
Subject Re: What's the best way to write this base class?
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
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.109.1308372833.1164.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 82.94.164.166
X-Trace 1308372833 news.xs4all.nl 49045 [::ffff:82.94.164.166]:41844
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:7886

Show key headers only | View raw


On Sat, Jun 18, 2011 at 2:17 PM, John Salerno <johnjsal@gmail.com> wrote:
> 1)
> class Character:
>
>    def __init__(self, name, base_health=50, base_resource=10):
>        self.name = name
>        self.health = base_health
>        self.resource = base_resource

If you expect to override the health/resource, I'd use this model.

ChrisA

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


Thread

What's the best way to write this base class? John Salerno <johnjsal@gmail.com> - 2011-06-17 21:17 -0700
  Re: What's the best way to write this base class? Chris Angelico <rosuav@gmail.com> - 2011-06-18 14:53 +1000
  Re: What's the best way to write this base class? "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-06-18 03:55 -0700
    Re: What's the best way to write this base class? Tim Chase <python.list@tim.thechases.com> - 2011-06-18 06:24 -0500
      Re: What's the best way to write this base class? "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-06-18 06:37 -0700
        Re: What's the best way to write this base class? Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-18 08:51 -0600
  Re: What's the best way to write this base class? TheSaint <nobody@nowhere.net.no> - 2011-06-18 19:04 +0800
  Re: What's the best way to write this base class? Mel <mwilson@the-wire.com> - 2011-06-18 10:22 -0400
  Re: What's the best way to write this base class? Ethan Furman <ethan@stoneleaf.us> - 2011-06-18 08:37 -0700
    Re: What's the best way to write this base class? John Salerno <johnjsal@gmail.com> - 2011-06-18 09:26 -0700
      Re: What's the best way to write this base class? Chris Angelico <rosuav@gmail.com> - 2011-06-19 02:34 +1000
      Re: What's the best way to write this base class? Chris Kaynor <ckaynor@zindagigames.com> - 2011-06-19 18:52 -0700
        Re: What's the best way to write this base class? John Salerno <johnjsal@gmail.com> - 2011-06-19 21:04 -0700
          Re: What's the best way to write this base class? Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-06-20 00:12 -0700
          Re: What's the best way to write this base class? Mel <mwilson@the-wire.com> - 2011-06-20 07:57 -0400
            Re: What's the best way to write this base class? Ian Kelly <ian.g.kelly@gmail.com> - 2011-06-20 12:31 -0600
          Re: What's the best way to write this base class? Terry Reedy <tjreedy@udel.edu> - 2011-06-20 13:58 -0400

csiph-web