(beginner) question on threads...

Fred Pacquier fredp at mygale.org.nospam
Tue Sep 4 12:41:30 EDT 2001


Joal Heagney <s713221 at student.gu.edu.au> said :

> *chuckles* You'll find this is THE best newsgroup to ask naive
> questions in. The gurus (Tim, Emile and Guido to name a few) don't mind
> answering the really interesting questions (Implementation, exotic
> classes etc.) people pop up, the intermediates take this as an example
> of good behaviour and take care of the medium level questions and then
> people like me answer as many newbie questions that they can accuratly
> field. The trick is to know when to shut up and let somebody more
> experienced field the question. Plus each of us at the just-above
> neophyte level has experience in different aspects of python, and how
> we learnt it - I know some of the beginner-useful modules (not all) and
> I'm very good at how to build python and python extension module rpms.

Yup -- that is definitely a huge part of the global python picture. There 
is the language itself and its own merits, and then there are the sorts of 
people who tend to gather around it, push it in various directions, and 
form its distinctive community. Don't know which way the chicken-and-egg 
aspect really works, but python certainly wouldn't be where it is without 
both...
 
> If you look at the standard library, you'll see one of the major
> principles of python coding is to keep the inheritance tree as flat as
> possible. For example, you have a module A, that imports module B,
> which imports module C. Now module A uses a function in module B that
> comes from module C. It is better code practice to import module C into
> module A and use the function directly, rather than rely on it being
> included in module B.

Well, in my own code I certainly take care to keep things at the simplicity 
level I feel I can handle :-)
But in this particular case, I was nosing through the standard lib's 
*HTTPServer modules, where classes are effectively nested a few levels 
deep.
 
>> Is there not a better way ? Some tool that will build a picture of a
>> class from its code, with all its methods and attributes, inherited or
>> not ? 
> 
> from pydoc import help
> import os
> help(os)
> class test:
>      def __init__(self,blah):
>           self.blah = blah
>      def afunc(self,values):
>           blahblablah
> class test2(test):
>      def bfunc(self):
>           blah-blablabla - blabblah
> help(test)
> And then the pydoc module supports other objects that let you build
> html/txt and output to file.

Aha. This is new in 2.x, right ? Need to look into that. Thanks for the tip 
and encouragement !
fp

-- 
YAFAP : http://www.multimania.com/fredp/



More information about the Python-list mailing list