PEP305 csv package: from csv import csv?

Magnus Lie Hetland mlh at furu.idi.ntnu.no
Wed Apr 9 20:03:40 EDT 2003


In article <mailman.1049814434.25284.python-list at python.org>, Hamish
Lawson wrote:
>According to the documentation in progress at
>
[snip]

Hey -- we finally get a csv package! Hooray!

>Is there some reason why the cvs

I assume you mean csv?

> package's __init__.py doesn't import the 
>required names from cvs.py,

csv.py, right? (I consistently make this mistake myself...)

> so allowing the shorter form below?

I agree that this should be done (assuming that that's what you think
too... :)

As far as I can see, csv.csv.__all__ contains the relevant names, so
simply adding

  from csv import *

to csv.__init__.py should do the trick nicely.

As for reasons -- the checkin message for the __init__.py (made by
Cliff Wells) is:

  "Make cvs [sic] into a package so we can have a util package"

So it seems that prior to this decision, csv was simply a module, and
the names were directly available. I'd think this to be preferrable,
and more consistent with existing library modules. We may have modules
containing classes with the same name, but this convention of placing
a module inside a package with the same name does not occur at all in
the libs. (Yes, I checked ;)

Of my currently installed packages, I see that numarray uses the
convention, for example, in its RandomArray2 module/package. However,
it also uses the above suggested convention of placing

  from RandomArray2 import *

in RandomArray/__init__.py.

So ... Are any of the PEP authors reading this? (Just checking -- as
this probably belongs on the discussion list... Sorry about that ;)

-- 
Magnus Lie Hetland               "Nothing shocks me. I'm a scientist." 
http://hetland.org                                   -- Indiana Jones




More information about the Python-list mailing list