numpy.power vs pylab.power

On my machine these are rather confusingly different functions, with the
latter corresponding to numpy.random.power. I appreciate that pylab
imports everything from both the numpy and numpy.random modules but
wouldn't it make sense if pylab.power were the oft-used power
function rather than a means for sampling from the power distribution?

Regards,

Will Furnass

Hey Will,

As a user, all I can tell you is that pylab is there for convenience when:
1) quickly and interactively exploring some new data
or
2) making the switch over from matlab or some other numerical analysis
framework.

In general, if you're doing some serious work -- especially work that
you might revisit at any point -- explicitly import the packages you
need into proper namespaces. As an example for me, this typically
amounts to:

import matplotlib.pyplot as plt
import numpy as np
import scipy.stats as stats
import pandas #as pd

···

On Thu, Nov 15, 2012 at 8:22 AM, Will Furnass <will@...4073...> wrote:

On my machine these are rather confusingly different functions, with the
latter corresponding to numpy.random.power. I appreciate that pylab
imports everything from both the numpy and numpy.random modules but
wouldn't it make sense if pylab.power were the oft-used power
function rather than a means for sampling from the power distribution?

Regards,

Will Furnass

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

I still think Will’s point is valid. What likely happened (and this is me completely guessing) is that np.random.power didn’t always exist. The pylab module just blindly imports these namespaces. Now, I do think that instead of np.power(), one should probably be using the “**” operator instead, but this does raise the issue of knowing when there are changes in the flatten namespace. Who’s to say that something else won’t collide in the future? We might need some sort of testing for this.

Ben Root

···

On Thu, Nov 15, 2012 at 12:06 PM, Paul Hobson <pmhobson@…287…> wrote:

Hey Will,

As a user, all I can tell you is that pylab is there for convenience when:

  1. quickly and interactively exploring some new data

or

  1. making the switch over from matlab or some other numerical analysis

framework.

In general, if you’re doing some serious work – especially work that

you might revisit at any point – explicitly import the packages you

need into proper namespaces. As an example for me, this typically

amounts to:

import matplotlib.pyplot as plt

import numpy as np

import scipy.stats as stats

import pandas #as pd