concise code (beginner)

Steven D'Aprano steven at REMOVE.THIS.cybersource.com.au
Thu Sep 6 23:42:07 EDT 2007


On Fri, 07 Sep 2007 12:03:26 +1000, bambam wrote:

> Hi Steven.
> 
> Looking at your code, why are you naming the value __all__? It looks
> like a built-in variable?

When you say:

from module import *

Python looks in the module for a list of names called "__all__", and 
imports only the names in that list. It is recommended that your modules 
take advantage of that feature. I'm just using the same name.


> Unless there is an automatic way to correctly get the function list, I
> will probably be better off giving the lines sequence numbers, and
> generating the function list from that.

I don't understand what you mean by "giving the lines sequence numbers". 
Where do they come from? How do you go from sequence numbers to functions?

As far as I am concerned, the right behavior is for the module containing 
the functions to define which functions need to be tested. Since modules 
aren't actually intelligent, that means some person needs to list the 
functions. Why list the function NAME when you can list the function 
itself?




More information about the Python-list mailing list