Re: Procedures and functions [was Re: Why not allow empty code blocks?]

2016-07-30 Thread Chris Angelico
On Sun, Jul 31, 2016 at 4:40 PM, Steven D'Aprano wrote: >> While neither is a syntax error, the latter is definitely a run-time >> error: >> > mylist.sort().reverse() >> Traceback (most recent call last): >> File "", line 1, in >> AttributeError: 'NoneType' object has no attribute 'reverse'

Re: Procedures and functions [was Re: Why not allow empty code blocks?]

2016-07-30 Thread Rustom Mody
On Sunday, July 31, 2016 at 12:10:33 PM UTC+5:30, Steven D'Aprano wrote: > On Sun, 31 Jul 2016 02:01 pm, D'Arcy J.M. Cain wrote: > > > On Sun, 31 Jul 2016 13:32:16 +1000 > > Steven D'Aprano wrote: > >> Many beginners make the mistake of writing: > >> > >> mylist = mylist.sort() > >> > >> or try

Re: Procedures and functions [was Re: Why not allow empty code blocks?]

2016-07-30 Thread Steven D'Aprano
On Sun, 31 Jul 2016 02:01 pm, D'Arcy J.M. Cain wrote: > On Sun, 31 Jul 2016 13:32:16 +1000 > Steven D'Aprano wrote: >> Many beginners make the mistake of writing: >> >> mylist = mylist.sort() >> >> or try to write: >> >> mylist.sort().reverse() >> >> If we had procedures, that would be an obv

Re: Procedures and functions [was Re: Why not allow empty code blocks?]

2016-07-30 Thread Random832
On Sun, Jul 31, 2016, at 00:01, D'Arcy J.M. Cain wrote: > On Sun, 31 Jul 2016 13:32:16 +1000 > Steven D'Aprano wrote: > > Many beginners make the mistake of writing: > > > > mylist = mylist.sort() > > > > or try to write: > > > > mylist.sort().reverse() > > > > If we had procedures, that would

Re: Procedures and functions [was Re: Why not allow empty code blocks?]

2016-07-30 Thread Chris Angelico
On Sun, Jul 31, 2016 at 1:32 PM, Steven D'Aprano wrote: >> It means you can't >> upgrade something from "always returns None" to "returns the number of >> objects frobbed" without breaking compat. > > You shouldn't ever need to. At least that's the theory. In practice its not > quite cut and dried

Re: Procedures and functions [was Re: Why not allow empty code blocks?]

2016-07-30 Thread D'Arcy J.M. Cain
On Sun, 31 Jul 2016 13:32:16 +1000 Steven D'Aprano wrote: > Many beginners make the mistake of writing: > > mylist = mylist.sort() > > or try to write: > > mylist.sort().reverse() > > If we had procedures, that would be an obvious error (possibly even a > compile-time syntax error) instead of

Re: Procedures

2009-06-23 Thread J. Cliff Dyer
Please keep the discussion on-list. (Reply-all, rather than just replying to me.) On Mon, 2009-06-22 at 15:36 -0700, Greg Reyna wrote: > It's not the error that concerned me. The fact that there is an > error of this type makes clear that there's something wrong with the > way the scripts are

Re: Procedures

2009-06-22 Thread Dave Angel
Greg Reyna wrote: Learning Python (on a Mac), with the massive help of Mark Lutz's excellent book, "Learning Python". What I want to do is this: I've got a Class Object that begins with a def. It's designed to be fed a string that looks like this: "scene 1, pnl 1, 3+8, pnl 2, 1+12, pnl 3,

Re: Procedures

2009-06-22 Thread J. Cliff Dyer
On Mon, 2009-06-22 at 12:13 -0700, Greg Reyna wrote: > Learning Python (on a Mac), with the massive help of Mark Lutz's > excellent book, "Learning Python". > > What I want to do is this: > I've got a Class Object that begins with a def. It's designed to be > fed a string that looks like this: