RE: [pyngl-talk] Your opinion

From: Ertl, John <John.Ertl_at_nyahnyahspammersnyahnyah>
Date: Fri, 24 Sep 2004 06:51:04 -0700

I like the proposal and I think this is really the only chance to make the
change. If you wait much longer too much code will have to be rewritten.
Thanks for being so flexible and really trying to make PyNGL as good as it
can be. I agree that the " from ***** import " causes more questions when
you first start.

John Ertl

-----Original Message-----
From: fred []
Sent: Thursday, September 23, 2004 14:24
Subject: Your opinion

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
  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)
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)
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?
   -- Your friendly PyNGL developers
pyngl-talk mailing list
pyngl-talk mailing list
Received on Fri Sep 24 2004 - 07:42:27 MDT

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