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


Groups > comp.lang.python > #32822

Re: Base class and Derived class question

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
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; 'interpreter': 0.04; 'subsequent': 0.04; 'debugging': 0.05; 'arguments': 0.07; 'bash': 0.07; 'exit': 0.07; 'properly.': 0.07; 'subject:question': 0.08; 'python': 0.09; 'brackets': 0.09; 'derived': 0.09; 'doing?': 0.09; 'imported.': 0.09; 'interpreter,': 0.09; 'typeerror:': 0.09; 'wrong,': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'file,': 0.15; 'angle': 0.16; 'given)': 0.16; 'guys,': 0.16; 'margin': 0.16; 'metaclass': 0.16; 'renamed': 0.16; 'subject:class': 0.16; 'wrote:': 0.17; 'tests.': 0.17; 'module': 0.19; 'trying': 0.21; 'import': 0.21; 'hey': 0.21; 'cc:2**0': 0.23; 'class.': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'run': 0.28; '>>>>': 0.29; 'source': 0.29; 'class': 0.29; "i'm": 0.29; 'error': 0.30; 'running': 0.32; 'print': 0.32; 'goes': 0.33; 'skip:d 20': 0.34; 'version': 0.34; 'especially': 0.35; 'so,': 0.35; 'something': 0.35; 'two': 0.37; 'subject:: ': 0.38; 'files': 0.38; 'nothing': 0.38; 'takes': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'most': 0.61; 'further': 0.61; 'first': 0.61; 'back': 0.62; 'safe': 0.63; 'email addr:gmail.com': 0.63; 'header:Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'confusing': 0.84; 'fin': 0.84; 'received:74.208.4.194': 0.84
Date Tue, 06 Nov 2012 09:13:18 -0500
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121011 Thunderbird/16.0.1
MIME-Version 1.0
To cyberirakli@gmail.com
Subject Re: Base class and Derived class question
References <fda16cf9-38dd-49ae-9f49-92bc963aac2e@googlegroups.com>
In-Reply-To <fda16cf9-38dd-49ae-9f49-92bc963aac2e@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:6oQ/x83QKo2KOxGPW2rQI/af4p8Zxl3t8s/dXi+AXI8 ef8pc0PHvaBCZbmuoo5ihL8lPSI4U6t+nO89qx+k8Bqh0gJ3/p oSS1rVc+U49nae3mnhCUDY3dGjst9BEIpe3oWc+9Q/0bt0WGK6 NdGHOSHiTCbTb4mYjimTgDm3XHEo0frpaxW/8xtz7MPJlcAmA2 fg6G5Bv7XMjUnWc7fybhTdr+i2clXbsRUl5hphKju6FWDPsQxU ITGp3hYjMbK+DqHDTHHk4YegUU+dHPrbP2WLq8N/hhdgxP2M5A 39MIQuCZlUJVlhCe3Ar6jPc7gg/X+LunjmS7VdHpEQCUcMAdw= =
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To d@davea.name
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.3324.1352211254.27098.python-list@python.org> (permalink)
Lines 56
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352211254 news.xs4all.nl 6976 [2001:888:2000:d::a6]:51723
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:32822

Show key headers only | View raw


On 11/06/2012 08:50 AM, cyberirakli@gmail.com wrote:
> Hey guys,
> I'm trying to understand how is working base class and derived class.

in what Python version ?

> So, I have to files baseClass.py and derivedClass.py. 
> baseClass.py : 
>>>> class baseClass():
How did all those angle brackets get into the file?  Are you confusing
an interactive interpreter session with running source files?

>     def bFunction(self):
This line isn't indented properly.  It must be further from the left
margin than the class declaration.
>         print "We are in a base class"
>
> derivedClass.py:
>>>> import baseClass as baseClassMod
> reload(baseClassMod)


reload() isn't safe to use, and especially on a module that's been
renamed while it was first imported.  It's a trick to speed up debugging
in the interactive interpreter, and when something goes wrong, you exit
the interpreter and try again.

> class derivedClass(baseClassMod):
>     def dFunction(self):
>         print "We are in a derived Class" 
>
> buwhen I'm trying to run derivedClass.py I get this error :

Again, what are you actually doing?  Running that file, or playing
around in the interpreter?

> TypeError: Error when calling the metaclass bases
>     module.__init__() takes at most 2 arguments (3 given)
>
> Interesting thing is that if I run baseClass.py and then run :

If you run baseClass.py, and get back to the bash prompt, then nothing
will affect subsequent tests.

>>>> class derivedClass(baseClass):
>     def dFunction(self):
>         print "We are in a derived Class"
> It works fin

Either use the interpreter or run from the shell.  This mixing of the
two is mighty confusing.

-- 

DaveA

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