Re: [Numpy-discussion] Syntax equivalent for np.array()

2010-02-10 Thread josef . pktd
On Wed, Feb 10, 2010 at 11:24 AM, Gökhan Sever wrote: > > > On Wed, Feb 10, 2010 at 10:12 AM, Gökhan Sever > wrote: >> >> >> On Wed, Feb 10, 2010 at 10:06 AM, Angus McMorland >> wrote: >>> >>> On 10 February 2010 11:02, Gökhan Sever wrote: >>> > Hi, >>> > >>> > Simple question: >>> > >>> > I[4]

Re: [Numpy-discussion] Syntax equivalent for np.array()

2010-02-10 Thread Gael Varoquaux
On Wed, Feb 10, 2010 at 08:33:11AM -0800, Keith Goodman wrote: > I think this is the rule: When empty it is a tuple; when containing > one item it is parentheses unless there is a comma. > >> p = (9) > >> type(p) > > >> p = (9,) > >> type(p) > The coma is the tuple operator. For instance

Re: [Numpy-discussion] Syntax equivalent for np.array()

2010-02-10 Thread Keith Goodman
On Wed, Feb 10, 2010 at 8:24 AM, Gökhan Sever wrote: > Self-correction: > > It works correctly in IPython-dev as well. > > And further in Python 2.6.2: > p = () p > () type(p) > type((a*b)) > > > ( ) doesn't only works as a tuple operator. It also has its original > parenthe

Re: [Numpy-discussion] Syntax equivalent for np.array()

2010-02-10 Thread Gökhan Sever
On Wed, Feb 10, 2010 at 10:12 AM, Gökhan Sever wrote: > > > On Wed, Feb 10, 2010 at 10:06 AM, Angus McMorland wrote: > >> On 10 February 2010 11:02, Gökhan Sever wrote: >> > Hi, >> > >> > Simple question: >> > >> > I[4]: a = np.arange(10) >> > >> > I[5]: b = np.array(5) >> > >> > I[8]: a*b.cumsum

Re: [Numpy-discussion] Syntax equivalent for np.array()

2010-02-10 Thread Gökhan Sever
On Wed, Feb 10, 2010 at 10:06 AM, Angus McMorland wrote: > On 10 February 2010 11:02, Gökhan Sever wrote: > > Hi, > > > > Simple question: > > > > I[4]: a = np.arange(10) > > > > I[5]: b = np.array(5) > > > > I[8]: a*b.cumsum() > > O[8]: array([ 0, 5, 10, 15, 20, 25, 30, 35, 40, 45]) > > > > I[

Re: [Numpy-discussion] Syntax equivalent for np.array()

2010-02-10 Thread Angus McMorland
On 10 February 2010 11:02, Gökhan Sever wrote: > Hi, > > Simple question: > > I[4]: a = np.arange(10) > > I[5]: b = np.array(5) > > I[8]: a*b.cumsum() > O[8]: array([ 0,  5, 10, 15, 20, 25, 30, 35, 40, 45]) > > I[9]: np.array(a*b).cumsum() > O[9]: array([  0,   5,  15,  30,  50,  75, 105, 140, 180

[Numpy-discussion] Syntax equivalent for np.array()

2010-02-10 Thread Gökhan Sever
Hi, Simple question: I[4]: a = np.arange(10) I[5]: b = np.array(5) I[8]: a*b.cumsum() O[8]: array([ 0, 5, 10, 15, 20, 25, 30, 35, 40, 45]) I[9]: np.array(a*b).cumsum() O[9]: array([ 0, 5, 15, 30, 50, 75, 105, 140, 180, 225]) Is there a syntactic equivalent for the I[9] --for instance