[egenix-users] cmp() function

Charlie Clark charlie at egenix.com
Mon Dec 19 15:09:37 CET 2005


On 2005-12-19 at 16:02:17 [+0100], M.-A. Lemburg <mal at egenix.com> wrote:
> No. In fact, the cmp() function was named deliberately after
> the builtin one. Falling back to the system one would only
> hide a programming error.

Python explicitly allows and to some extent encourages this style. Wrapping 
things up in namespaces should avoid most errors.

> In summary: You should never do "from mx.DateTime import *" -
> that's bad style :-)

I agree with this. I remember reading at one point that import * was to be 
made illegal in Python. The documentation should be updated to reflect this!

> I tend to always write:
> 
> from mx import DateTime
> ...
> d = DateTime.now()
> 
> Makes reading the code a lot easier too, esp. if you regularly
> work with or on large frameworks

Correct use of namespaces is one of the greatest things in Python. With 
"as" allowing redesignation as required.

Charlie



More information about the egenix-users mailing list