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


Groups > comp.lang.python > #3064

Re: OOP only in modules

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <awilliam@whitemice.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; 'bug': 0.02; 'involves': 0.07; 'python': 0.07; '"""': 0.09; 'exception': 0.12; 'wrote:': 0.14; 'code...': 0.16; 'examples.': 0.16; 'f()': 0.16; 'from:addr:awilliam': 0.16; 'from:addr:whitemice.org': 0.16; 'from:name:adam tauno williams': 0.16; 'imo,': 0.16; 'message-id :@linux-yu4c.site': 0.16; 'non-trivial': 0.16; 'objects:': 0.16; 'received:72.14.190': 0.16; 'received:72.14.190.87': 0.16; 'received:mail.wmmi.net': 0.16; 'received:wmmi.net': 0.16; 'reply- to:addr:awilliam': 0.16; 'reply-to:addr:whitemice.org': 0.16; 'subject:OOP': 0.16; 'subject:modules': 0.16; 'trace.': 0.16; 'trees': 0.16; 'w/o': 0.16; 'libraries': 0.16; 'stack': 0.16; 'stuff': 0.18; 'besides': 0.19; 'modules': 0.20; 'tree': 0.20; 'tue,': 0.20; 'help.': 0.22; 'code': 0.22; 'header:In-Reply-To:1': 0.22; '(and': 0.22; 'oriented': 0.23; '.net': 0.25; 'script': 0.26; 'moving': 0.26; 'programs.': 0.26; 'instead': 0.26; 'classes': 0.26; 'received:72.14': 0.27; 'function': 0.27; 'helpful': 0.29; 'miles': 0.29; "python's": 0.29; 'subject:only': 0.31; 'called': 0.32; 'to:addr:python-list': 0.32; 'another': 0.32; "i've": 0.33; 'experience,': 0.33; 'uses': 0.34; 'using': 0.34; 'received:192.168.1': 0.34; 'received:192': 0.34; 'tools.': 0.35; '-0700,': 0.35; 'languages.': 0.35; 'long.': 0.35; 'small,': 0.35; 'growing': 0.36; 'usually': 0.36; 'received:192.168': 0.37; 'used': 0.38; 'component': 0.39; 'to:addr:python.org': 0.39; 'header:Mime-Version:1': 0.39; 'how': 0.39; 'issues': 0.39; 'learn': 0.60; 'increase': 0.61; 'url:net': 0.62; 'making': 0.62; 'url:p': 0.63; 'world': 0.65; 'hand,': 0.72; 'reply-to:no real name:2**0': 0.72; 'header:Reply-To:1': 0.72; 'programs,': 0.77; 'judicious': 0.84
Subject Re: OOP only in modules
From Adam Tauno Williams <awilliam@whitemice.org>
To python-list@python.org
In-Reply-To <1187a735-b153-4993-b8fa-21727870ad84@w36g2000vbi.googlegroups.com>
References <mailman.195.1302457348.9059.python-list@python.org> <1187a735-b153-4993-b8fa-21727870ad84@w36g2000vbi.googlegroups.com>
Content-Type text/plain; charset="UTF-8"
Date Tue, 12 Apr 2011 13:26:21 -0400
Mime-Version 1.0
X-Mailer Evolution 2.32.1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
Reply-To awilliam@whitemice.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.265.1302629217.9059.python-list@python.org> (permalink)
Lines 43
NNTP-Posting-Host 82.94.164.166
X-Trace 1302629217 news.xs4all.nl 41113 [::ffff:82.94.164.166]:36332
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:3064

Show key headers only | View raw


On Tue, 2011-04-12 at 08:33 -0700, newpyth wrote:
> """ call tree w/o classes and objects:
> E()                                   #~15  called from #~35
> +-- F()                               #~18                16
> |    +-- raw_input('Addressed to ')   #     called from   19
> +-- G()                               #~21                18
> 
> G()                                   #~21                36
> """
> </code>
> Beeing the script so small, the above call tree can be
> build up by hand,

IMO, in any real-world application your call-graph is miles long.  This
is really not much more than a stack trace.

> It not an easy task... therefore I called help.
> in my experience, I am convinced that call trees (together with xref)
> are the main tools to understand not trivial python programs.
> Instead of using debuggers, 

Even better, since the real world usually involves non-trivial programs,
is to learn to use debuggers and the provided tools.  I've not had any
issues read the strack-trace generated by an exception in an OO Python
application [as I maintain a >100,000 line and growing component
oriented Python applications
<https://www.ohloh.net/p/coils/analyses/latest>]

> with these tools (and with the
> judicious use of trace) you can solve any bug and besides that
> acquire a  better understanding of the program.
> Another advantage of moving OO stuff to modules is the "sharp
> increase in re-usability of code...

Only if your code remains as trivial as your examples.

> In my understanding modules are the python's implementation
> of libraries very much used by other languages.

Making these kind of analogies is not helpful and will only confuse.  C
uses libraries, .NET uses assemblies, Python uses modules... and how
these function and perform differs in important ways.

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


Thread

Re: OOP only in modules Andrea Crotti <andrea.crotti.0@gmail.com> - 2011-04-10 19:42 +0200
  Re: OOP only in modules newpyth <newpyth@gmail.com> - 2011-04-12 08:33 -0700
    Re: OOP only in modules Adam Tauno Williams <awilliam@whitemice.org> - 2011-04-12 13:26 -0400

csiph-web