From: Dave Angel on 16 Jun 2010 14:09 Victor Subervi wrote: > <snip> > > DavidA corrects me: > > >> Since you didn't name your modules (what you persist in calling scripts), >> I can only guess their names from the import statements: >> e.g.: >> > >from New_Passengers_Curr_Customers import New_Passengers_Curr_Customers > >> I don't see any case difference there. >> > > Right. Gotcha. Started that because I saw others doing it. A bad habit? The > file (in this case) New_Passengers_Curr_Customers.py has only one method, to > wit, New_Passengers_Curr_Customers(). Not a good idea? Please clarify and if > not, why. > Thanks all, > beno > > There are three levels which contributed to it being a bad idea. 1) Only one object defined in a module is usually a waste. If it really stands alone, then fine. I'm not going to judge, just pointing it out. About the only time I find myself doing that is when there are plugins, so each wants to be its own file, and you choose at run time which to import. 2) Having two objects of completely different types, both of global scope, and giving them the same name, not even distinguished by capitalization, can be very confusing. It comes up frequently on this list, as a barrier to understanding. 3) Referring to "calling" a "script", when you actually meant calling a function by the same name as the module was the trigger that made me speak up. Fix any one of them, and I'd probably have kept quiet. DaveA
First
|
Prev
|
Pages: 1 2 3 4 5 Prev: numpy arrays to python compatible arrays Next: Py++, boost and python type mismatch error |