From: Bruce S. <bas...@nc...> - 2010-10-08 21:44:37
|
This proposal assumed that the "libvisual" file was in the visual folder, in which case I thought that relative imports were now favored, for various reasons. As I understand it, the main issue is that there could be a module named "foo" at a higher level in the search path, in which case "import foo" might not pick up our foo, but someone else's foo. Have I misunderstood something? Bruce Sherwood On Fri, Oct 8, 2010 at 2:57 PM, Guy K. Kloss <g....@ma...> wrote: > On Fri, 08 Oct 2010 17:39:59 Bruce Sherwood wrote: >> Here's another possibility for the contents of a file in the visual >> folder, perhaps called libvisual as has been suggested: >> >> ---------------------------------------------------- >> from . import cvisual >> from .cvisual import (vector, mag, mag2, norm, cross, rotate, >> comp, proj, diff_angle, rate, waitclose) >> from .primitives import (arrow, cylinder, cone, sphere, box, ring, label, >> frame, pyramid, ellipsoid, curve, >> faces, convex, helix, >> points, text, distant_light, local_light) >> from . ui import display >> from . import crayola >> color = crayola >> from . import materials >> from . import site_settings >> ---------------------------------------------------- > > Why all these funky relative imports ("from . import foo")? > > It should be much cleaner to just say "import foo"! > > Guy > > -- > Guy K. Kloss > Institute of Information and Mathematical Sciences > Te Kura Pūtaiao o Mōhiohio me Pāngarau > Massey University, Albany (North Shore City, Auckland) > 473 State Highway 17, Gate 1, Mailroom, Quad B Building > voice: +64 9 414-0800 ext. 9266 fax: +64 9 441-8181 > G....@ma... http://www.massey.ac.nz/~gkloss > > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today. > http://p.sf.net/sfu/beautyoftheweb > _______________________________________________ > Visualpython-users mailing list > Vis...@li... > https://lists.sourceforge.net/lists/listinfo/visualpython-users > > |