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


Groups > comp.lang.python > #32827

Re: Base class and Derived class question

Path csiph.com!usenet.pasdenom.info!news.albasani.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:question': 0.08; 'python': 0.09; 'brackets': 0.09; 'namespace': 0.09; 'tends': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'java,': 0.15; 'angle': 0.16; 'confusion': 0.16; 'subject:class': 0.16; 'usenet': 0.16; 'wrote:': 0.17; 'compilation': 0.17; 'module,': 0.17; 'module': 0.19; 'import': 0.21; 'cc:2**0': 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'skip:[ 10': 0.26; 'am,': 0.27; 'separate': 0.27; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'correct': 0.28; 'class': 0.29; 'classes': 0.30; 'received:209.85.215.46': 0.30; 'code': 0.31; 'file': 0.32; 'skip:d 20': 0.34; 'received:google.com': 0.34; 'nov': 0.35; 'posting': 0.35; 'received:209.85': 0.35; 'there': 0.35; "didn't": 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'where': 0.40; 'header:Received:5': 0.40; 'group,': 0.60; 'first': 0.61
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=hPtAfc6F106dMDpcKRZHA4zLYHUA3jAtvymM5P1iGgQ=; b=iWkNh3NjV4w4ltlQJlTbh9K55A2t+YGLl+hQc6gImON8rc0nnX9EFmq0c/RMFiNQlQ UreM8POugaOmCA6WeGEXoKWcFJdxTZdZMkLz+Jl1ov2tRXT6h8sOB1AxgTJ7dXW2PDbe ua/vciHl9SFhhf8t0GLUCN6ulFaU4QLpZdhyAf3WABqi5RURIy6DTGyOFc6i90W8tfgU ijAMMtdvkosdCnH3fr2kktMoGMXYbqPfB5wxr9IktnXSq34nc3AFjkWfcMwH4btbU7NE UQ8KX8o2jPSo7onyps7ie8YR5olz5R3p97hhDFgPm637C2676zuLnjKwr/hd2/KrZOVb C51g==
MIME-Version 1.0
In-Reply-To <23df4f00-2285-44cc-a9aa-aeb319d000fb@googlegroups.com>
References <fda16cf9-38dd-49ae-9f49-92bc963aac2e@googlegroups.com> <mailman.3324.1352211254.27098.python-list@python.org> <23df4f00-2285-44cc-a9aa-aeb319d000fb@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 6 Nov 2012 08:34:44 -0700
Subject Re: Base class and Derived class question
To cyberirakli@gmail.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.3328.1352216117.27098.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352216117 news.xs4all.nl 6966 [2001:888:2000:d::a6]:58244
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32827

Show key headers only | View raw


On Tue, Nov 6, 2012 at 8:03 AM,  <cyberirakli@gmail.com> wrote:
> I've used angle brackets just for posting here,becauze this forum doesn't support [code][/code]

This is a Usenet group, not a web forum.

> Just got answer, I didn't call a class it's self.  Correct code is:
> class derivedClass(baseClassMod.baseClass):
>     def ......

Better style would be to import the class from the module in the first place:

    from baseClass import baseClass

    # ...

    class derivedClass(baseClass):
        # ...

Better yet would be to put both classes in the same file in the first
place.  Python isn't Java, where each class is an independent
compilation unit.  There is no reason to put each class in its own
separate module, and it tends to cause namespace confusion as you have
discovered.

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


Thread

Base class and Derived class question cyberirakli@gmail.com - 2012-11-06 05:50 -0800
  Re: Base class and Derived class question Dave Angel <d@davea.name> - 2012-11-06 09:13 -0500
    Re: Base class and Derived class question cyberirakli@gmail.com - 2012-11-06 07:03 -0800
      Re: Base class and Derived class question Ian Kelly <ian.g.kelly@gmail.com> - 2012-11-06 08:34 -0700
        Re: Base class and Derived class question cyberirakli@gmail.com - 2012-11-06 08:22 -0800
        Re: Base class and Derived class question cyberirakli@gmail.com - 2012-11-06 08:22 -0800
    Re: Base class and Derived class question cyberirakli@gmail.com - 2012-11-06 07:03 -0800
  Re: Base class and Derived class question cyberirakli@gmail.com - 2012-11-06 07:08 -0800
    Re: Base class and Derived class question alex23 <wuwei23@gmail.com> - 2012-11-06 18:10 -0800

csiph-web