Re: Your opinion

From: Jeff Whitaker <jswhit_at_nyahnyahspammersnyahnyah>
Date: Sat, 25 Sep 2004 08:59:40 -0600

fred wrote:

>Dear PyNGLers -
>
>A couple of our alpha testers have suggested that it would
>be preferable to use the form:
>
> import Ngl
>
>rather than
>
> from Ngl import *
>
>Whereas most of the functions in Ngl have an "ngl_" prefix
>(in parallel with the "gsn_" prefix in GSUN), potential for
>name clashes exists for names like "Resources". So, we are
>inclined to agree that the "import Ngl" form is preferable.
>
>As a consequence, we are considering a significant change.
>Since using an "import Ngl" now would produce redundant syntax
>like:
>
> plot = Ngl.ngl_contour(wks,var)
>
>in moving toward favoring the "import Ngl" form, we would remove
>all of the "ngl_" prefixes.
>
>For example, the current code,
>
> from Scientific.IO.NetCDF import NetCDFFile
> from Ngl import *
>
> dirc = ncargpath("data")
> nfile = NetCDFFile(dirc + "/cdf/meccatemp.cdf","r")
> T = nfile.variables["t"][0,:,:]
> wks = ngl_open_wks("pdf","code")
> contour = ngl_contour(wks,T)
>
> ngl_end()
>
>
>would become:
>
>
> from Scientific.IO.NetCDF import NetCDFFile
> import Ngl
>
> dirc = Ngl.ncargpath("data")
> nfile = NetCDFFile(dirc + "/cdf/meccatemp.cdf","r")
> T = nfile.variables["t"][0,:,:]
> wks = Ngl.open_wks("pdf","code")
> contour = Ngl.contour(wks,T)
>
> Ngl.end()
>
>Implementing this change would pretty much preclude ever using
>the "from Ngl import *" form, since there would now be lots of
>possible name clashes, like "end", "contour", etc.
>
>We would like to do this, but would making this change at this time
>be too disruptive?
>
>
>

Fred: I vote no. I'm worried that people will still do "from import *"
and end up with really ugly name clashes if the 'ngl_' prefix is
removed. If you leave it the way it is, users can choose whether to
'import Ngl' and add the 'Ngl.', or use 'from ngl import *' and leave
the 'Ngl.' off if they wish. As you pointed out, the ngl_ prefix
prevents name clashes if users choose the latter.

Basically, I don't see that it's broken, so why fix it?

-Jeff

-- 
Jeffrey S. Whitaker         Phone : (303)497-6313
NOAA/OAR/CDC  R/CDC1        FAX   : (303)497-6449
325 Broadway                Web   : http://www.cdc.noaa.gov/~jsw
Boulder, CO, USA 80305-3328 Office: Skaggs Research Cntr 1D-124
_______________________________________________
pyngl-talk mailing list
pyngl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Sat Sep 25 2004 - 22:24:12 MDT

This archive was generated by hypermail 2.2.0 : Thu Jan 19 2006 - 21:30:16 MST