How to import only one module in a package when the package __init__.py has already imports the modules?

Dave Angel davea at ieee.org
Sat Oct 31 22:18:13 EDT 2009


Peng Yu wrote:
> On Sat, Oct 31, 2009 at 5:45 PM, Wolodja Wentland
> <wentland at cl.uni-heidelberg.de> wrote:
>   
>> On Sat, Oct 31, 2009 at 16:53 -0500, Peng Yu wrote:
>>     
>>> On Sat, Oct 31, 2009 at 4:14 PM, Robert Kern <robert.kern at gmail.com> wrote:
>>>       
>> [ snip ]
>>
>>     
>>> I know that multiple classes or functions are typically defined in one
>>> file (i.e. module in python). However, I feel this make the code not
>>> easy to read. Therefore, I insist on one class or function per file
>>> (i.e module in python).
>>>       
>> Are you serious? Do you *really* put each function in its own file? How
>> exactly does this enhance the readability of the source code? Especially
>> if you compare that to a (sic!) modularisation scheme that groups
>> classes and functions together by task or semantic relatedness.
>>     
>
> <snip>
> One advantage is on refactoring. When each function has its own file,
> I can change variable names, etc., for a give function without
> worrying accidentally change variable names in other functions. When I
> find a function is more appropriate to put in another namespace, I can
> just move the file around.
>
>   
Variables in a function are already private.  How can the names in one 
function be affected by other functions in the same module?

DaveA




More information about the Python-list mailing list