[Numpy-discussion] Synonym standards

Robert Kern robert.kern@gmail....
Thu Jul 26 18:12:45 CDT 2012


On Fri, Jul 27, 2012 at 12:05 AM, Colin J. Williams
<cjwilliams43@gmail.com> wrote:
> On 26/07/2012 4:57 PM, Benjamin Root wrote:
>
>
> On Thu, Jul 26, 2012 at 4:45 PM, Colin J. Williams <fn681@ncf.ca> wrote:
>>
>> It seems that these standards have been adopted, which is good:
>>
>> The following import conventions are used throughout the NumPy source and
>> documentation:
>>
>> import numpy as np
>> import matplotlib as mpl
>> import matplotlib.pyplot as plt
>>
>> Source:
>> https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt
>>
>> Is there some similar standard for PyLab?
>>
>> Thanks,
>>
>> Colin W.
>>
>
>
> Colin,
>
> Typically, with pylab mode of matplotlib, you do:
>
> from pylab import *
>
> This is essentially equivalent to:
>
> from numpy import *
> from matplotlib.pyplot import *
>
> Note that the pylab "module" is actually a part of matplotlib and is a
> shortcut to provide an environment that is very familiar to Matlab users.
> Converts are then encouraged to use the imports you mentioned in order to
> properly utilize python namespaces.
>
> I hope that helps!
> Ben Root
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
> Thanks Ben,
>
> I would prefer not to use:  from xxx import *,
>
> because of the name pollution.
>
> The name  convention that I copied above facilitates avoiding the pollution.
>
> In the same spirit, I've used:
> import pylab as plb

But in that same spirit, using np and plt separately is preferred.

-- 
Robert Kern


More information about the NumPy-Discussion mailing list