Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-30 Thread Random832
On Wed, Mar 30, 2016, at 19:01, Dennis Lee Bieber wrote: > Though I'm surprised GoogleGroups would expire that fast. > > Google is the reason I inserted that header -- I started back in the > days when news-servers routinely expired stuff (text groups about monthly > lifespan, the bina

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-30 Thread Rustom Mody
On Wednesday, March 30, 2016 at 10:37:58 PM UTC+5:30, Random832 wrote: > On Wed, Mar 30, 2016, at 12:59, Rustom Mody wrote: > > On Wednesday, March 30, 2016 at 7:56:50 PM UTC+5:30, Ben Bacarisse wrote: > > > Dennis Lee Bieber writes: > > > > Sorry Dennis > > Dont see you at all > > Neither on goo

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-30 Thread Random832
On Wed, Mar 30, 2016, at 12:59, Rustom Mody wrote: > On Wednesday, March 30, 2016 at 7:56:50 PM UTC+5:30, Ben Bacarisse wrote: > > Dennis Lee Bieber writes: > > Sorry Dennis > Dont see you at all > Neither on googlegroups -- which of course everyone loves to hate > Nor the archive: > https://mail

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-30 Thread Rustom Mody
On Wednesday, March 30, 2016 at 7:56:50 PM UTC+5:30, Ben Bacarisse wrote: > Dennis Lee Bieber writes: Sorry Dennis Dont see you at all Neither on googlegroups -- which of course everyone loves to hate Nor the archive: https://mail.python.org/pipermail/python-list/2016-March/date.html Only see y

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-30 Thread Ben Bacarisse
Dennis Lee Bieber writes: > On Tue, 29 Mar 2016 20:14:02 -0700 (PDT), Rustom Mody > declaimed the following: > > >>Pascal ? C ? Python is a slide down because >>Pascal had the clear distinction of procedure and function > > That goes back to FORTRAN (in which one has SUBROUTINE subprocedur

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-29 Thread Rustom Mody
On Tuesday, March 29, 2016 at 12:18:38 AM UTC+5:30, Paul Rubin wrote: > BartC writes: > > With more recent ones I've dropped that model, so that statements and > > expressions are different, and that is strictly enforced. This makes > > implementation simpler, and detects lots more errors. > > Yo

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-29 Thread Steven D'Aprano
On Tue, 29 Mar 2016 10:31 pm, BartC wrote: > On 29/03/2016 09:26, Steven D'Aprano wrote: >> On Monday 28 March 2016 12:40, Paul Rubin wrote: > > >> The point is that there's nothing intrinsically obvious or right about >> "return the value of the last statement in the block". > > But that's exa

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-29 Thread BartC
On 29/03/2016 09:26, Steven D'Aprano wrote: On Monday 28 March 2016 12:40, Paul Rubin wrote: The point is that there's nothing intrinsically obvious or right about "return the value of the last statement in the block". But that's exactly what happens inside a typical function: you have lin

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-29 Thread Marko Rauhamaa
Steven D'Aprano : > On Monday 28 March 2016 12:40, Paul Rubin wrote: > >> Steven D'Aprano writes: >>> if condition: >>> print(1) >>> print(2) >>> else: >>> print(3) >>> print(4) >>> what value should it return? Justify your choice. >> >> It could whatever value that the last call

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-29 Thread Chris Angelico
On Tue, Mar 29, 2016 at 7:26 PM, Steven D'Aprano wrote: > del x > > Should it return None? The string 'x'? How about the value that x had just > before it was deleted? True if that allowed the value to be garbage > collected, False if it wasn't? Or the other way around? None of these > suggests fe

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-29 Thread Paul Rubin
Steven D'Aprano writes: > The point is that there's nothing intrinsically obvious or right about > "return the value of the last statement in the block". Strictly speaking it returns the value of the block itself. The block is usually evaluated by PROG which returns the last value of the block

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-29 Thread Steven D'Aprano
On Monday 28 March 2016 12:40, Paul Rubin wrote: > Steven D'Aprano writes: >> if condition: >> print(1) >> print(2) >> else: >> print(3) >> print(4) >> what value should it return? Justify your choice. > > It could whatever value that the last call to print() returns. Lisp > has

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-28 Thread Ben Bacarisse
BartC writes: > On 28/03/2016 01:54, Steven D'Aprano wrote: >> What should be the return value of this statement? >> >> while True: >> x += 1 >> if condition: break > > Many statements such as loops just returned 'void' in A68. The > interesting statements were if, case-switch and bloc

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-28 Thread Paul Rubin
BartC writes: > With more recent ones I've dropped that model, so that statements and > expressions are different, and that is strictly enforced. This makes > implementation simpler, and detects lots more errors. You should try Haskell, where there are only expressions, but the ones that perform

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-28 Thread BartC
On 28/03/2016 01:54, Steven D'Aprano wrote: On Mon, 28 Mar 2016 03:58 am, BartC wrote: One of Guido's principles in designing Python was to keep it simple, even where that might mean people could make errors with it. This part of the language is no different: any expression can be a statement.

Re: Statements as expressions [was Re: Undefined behaviour in C]

2016-03-27 Thread Paul Rubin
Steven D'Aprano writes: > if condition: > print(1) > print(2) > else: > print(3) > print(4) > what value should it return? Justify your choice. It could whatever value that the last call to print() returns. Lisp has worked like that since the 1950's. > What should be the return

Statements as expressions [was Re: Undefined behaviour in C]

2016-03-27 Thread Steven D'Aprano
On Mon, 28 Mar 2016 03:58 am, BartC wrote: >> One of Guido's principles in designing Python was to keep it simple, >> even where that might mean people could make errors with it. This part >> of the language is no different: any expression can be a statement. > > Yeah, but even simpler would be