From: Bruce S. <bas...@nc...> - 2010-09-18 04:16:52
|
In this context, we could invent conventions for the "as" name, such as "import visual.objects as vo", as has been done by the scipy.org community. Here is what they say at http://docs.scipy.org/doc/scipy/reference/tutorial/general.html: For brevity and convenience, we will often assume that the main packages (numpy, scipy, and matplotlib) have been imported as: >>> import numpy as np >>> import scipy as sp >>> import matplotlib as mpl >>> import matplotlib.pyplot as plt These are the import conventions that our community has adopted after discussion on public mailing lists. You will see these conventions used throughout NumPy and SciPy source code and documentation. While we obviously don’t require you to follow these conventions in your own code, it is highly recommended. On Wed, Sep 15, 2010 at 10:54 PM, Bruce Sherwood <bas...@nc...> wrote: > I'll immediately offer an alternative. Suppose there is in the visual > folder a file vobjects.py containing this: > > from .primitives import (arrow, cylinder, cone, sphere, box, ring, label, > frame, pyramid, ellipsoid, curve, > faces, convex, helix, > points, text, distant_light, local_light) > > Then you could do this: > > import visual.vobjects as vo > c = vo.curve(pos=[(0,0,0), (1,0,0), (0,1,0)]) > > Would this be preferable to the following? > > from visual.primitives import curve > c = curve(pos=[(0,0,0), (1,0,0), (0,1,0)]) > > Similarly, there could be a visual/vector.py file for the vector stuff > (vector, mag, etc.). There are already visual.crayola and > visual.materials files of this kind. > > Bruce Sherwood |