[Tutor] Re: Philosphy on method naming in modules?

Terry Carroll carroll at tjc.com
Thu Sep 4 21:38:03 EDT 2003


On Fri, 5 Sep 2003, Andrei wrote:

> "from something import *" is bad form in Python and this I suppose is 
> one of the reasons :).

Ah, I didn't know that.  I see it in a lot of books, so I assumed it was 
common, or at leat not bad form. I don't like doing it myself.

> I for one would call it something meaningful (Display isn't really 
> descriptive IMO, especially if it's a function, not a class method - but 
> then again, I haven't seen the module, perhaps the name says it all in 
> your case). 

Display's pretty meaningful, actually.  It displays all the data in the 
entry for the character.  I wouldn't have the method at all, except that 
the characters in question are all CJKV characters, and can't be displayed 
using "print," so I put all the data in a Tkinter window.

> On a sidenote, I for one also prefer "displayUnihan" (verb first and
> starting with a lowercase), but this is very much a matter of taste I
> suppose. 

I gotta side with Jeff on this one.  It bugs me to see a name with 
uppercase characters in it starting with lower case.  Using the XML 
modules, with names like "setContentHandler", makes me batty.

Thanks for the input on this.  I'm not going to sweat the names too much,
then.  People who use my module and use "from Unihan import *" just have
to be careful.

-- 
Terry Carroll        |   "I say to you that the VCR is to the American
Santa Clara, CA      |   film producer and the American public as the 
carroll at tjc.com      |   Boston strangler is to the woman home alone."  
                     |       Jack Valenti, MPAA President
Modell delendus est  |       Testimony before Congress, 1982





More information about the Tutor mailing list