Re: Pass and return

2012-12-21 Thread Mitya Sirenef
On 12/21/2012 03:52 AM, Duncan Booth wrote: Mitya Sirenef wrote: On 12/21/2012 12:23 AM, iMath wrote: Pass and return Are these two functions the same ? def test(): return def test(): pass From the point of style, of course, the latter is much better because that'

Re: Pass and return

2012-12-21 Thread Duncan Booth
Mitya Sirenef wrote: > On 12/21/2012 12:23 AM, iMath wrote: >> Pass and return >> Are these two functions the same ? >> >> def test(): >> return >> >> def test(): >> pass > > > From the point of style, of course, the l

Re: Pass and return

2012-12-21 Thread Steven D'Aprano
On Thu, 20 Dec 2012 21:23:58 -0800, iMath wrote: > Pass and return > Are these two functions the same ? They are neither functions, nor are they the same. Check if they are functions: - can you pass them arguments? - can you assign their result to a target? No. py> pass(23) File &

Re: Pass and return

2012-12-20 Thread Chris Angelico
On Fri, Dec 21, 2012 at 4:23 PM, iMath wrote: > Pass and return > Are these two functions the same ? > > def test(): > return > > def test(): > pass They're different statements, but in this case they happen to accomplish the same thing. The pas

Re: Pass and return

2012-12-20 Thread Mitya Sirenef
On 12/21/2012 12:23 AM, iMath wrote: Pass and return Are these two functions the same ? def test(): return def test(): pass From the point of style, of course, the latter is much better because that's the idiomatic way to define a no-op function. With a return, it

Re: Pass and return

2012-12-20 Thread Mitya Sirenef
On 12/21/2012 12:23 AM, iMath wrote: Pass and return Are these two functions the same ? def test(): return def test(): pass I believe they are the same, but these statements have different meanings in other circumstances, e.g.: Class A(object): pass def test(): if x

Pass and return

2012-12-20 Thread iMath
Pass and return Are these two functions the same ? def test(): return def test(): pass -- http://mail.python.org/mailman/listinfo/python-list

Re: call python from c -> pass and return arrays/lists

2008-04-10 Thread Pieter
printf("Didn't work, NO INT"); } } } kind regards, Pieter -- Doorgestuurd bericht -- From: "Diez B. Roggisch" <[EMAIL PROTECTED]> To: python-list@python.org Date: Thu, 10 Apr 2008 12:23:56 +0200 Subject: Re: call python from c ->

Re: call python from c -> pass and return arrays/lists

2008-04-10 Thread Diez B. Roggisch
Pieter wrote: > Hi all, > > I'm trying to call a python function from c. I need to pass an > 2D-array to python and the python function returns a 2D-list back to > c. I googled arround and I found how to pass ints/strings/... back and > forth, but didn't find anything on passing arrays. > > For

call python from c -> pass and return arrays/lists

2008-04-10 Thread Pieter
Hi all, I'm trying to call a python function from c. I need to pass an 2D-array to python and the python function returns a 2D-list back to c. I googled arround and I found how to pass ints/strings/... back and forth, but didn't find anything on passing arrays. For an int it's as simple as this: