Re: Introducing the "for" loop

2017-10-10 Thread Peter Otten
Stefan Ram wrote: > Which advice do you refer to? Teach the parts that are most useful first, i. e. for loops over anything but range rather than while loops. -- https://mail.python.org/mailman/listinfo/python-list

Re: Introducing the "for" loop

2017-10-07 Thread Steve D'Aprano
On Sun, 8 Oct 2017 03:58 am, Terry Reedy wrote: > No built-in function is an instance of FunctionType > >>> isinstance(compile, FunctionType) > False Ah yes, thanks Terry, I forgot that builtin functions have a distinct type. [...] > FunctionType == function defined by def statement or

Re: Introducing the "for" loop

2017-10-07 Thread Chris Angelico
On Sun, Oct 8, 2017 at 3:58 AM, Terry Reedy wrote: > No built-in function is an instance of FunctionType isinstance(compile, FunctionType) > False isinstance(print, FunctionType) > False type(compile) > type(int.bit_length) > > > > FunctionType == function

Re: Introducing the "for" loop

2017-10-07 Thread Terry Reedy
On 10/7/2017 5:09 AM, Steve D'Aprano wrote: On Fri, 6 Oct 2017 11:44 pm, ROGER GRAYDON CHRISTMAN wrote: Despite the documentation, I would still be tempted to say that range is a function. Taking duck-typing to the meta-level, every time I use range, I use its name followed by a pair of

Re: Introducing the "for" loop

2017-10-07 Thread Steve D'Aprano
On Fri, 6 Oct 2017 11:44 pm, ROGER GRAYDON CHRISTMAN wrote: > Despite the documentation, I would still be tempted to say that range is a > function. > Taking duck-typing to the meta-level, every time I use range, I use its name > followed > by a pair of parentheses enclosing one to three

Re: callable values (was: Introducing the "for" loop)

2017-10-06 Thread Steve D'Aprano
On Sat, 7 Oct 2017 03:25 am, Stefan Ram wrote: > FWIW, in my course notes, I have coined a special word for > this: > > A /prelate/ (German: "Prälat") is a callable value (object). In English, prelate is a kind of priest, a senior clergyman and dignitary. I don't know whether German

Re: Introducing the "for" loop

2017-10-06 Thread Terry Reedy
On 10/6/2017 8:44 AM, ROGER GRAYDON CHRISTMAN wrote: Despite the documentation, I would still be tempted to say that range is a function. It is, *according* to the documentation. Built-in classes are included in Library Reference, Ch. 2, Built-in Functions. Changing that to "Built-in

Re: Introducing the "for" loop

2017-10-06 Thread Paul Moore
On 6 October 2017 at 13:44, ROGER GRAYDON CHRISTMAN wrote: > Despite the documentation, I would still be tempted to say that range is a > function. > Taking duck-typing to the meta-level, every time I use range, I use its name > followed > by a pair of parentheses enclosing one to

Re: Introducing the "for" loop

2017-10-06 Thread ROGER GRAYDON CHRISTMAN
On Thu, Oct 5, 2017 7:45 PM, breamore...@gmail.com wrote: > On Friday, October 6, 2017 at 2:05:58 AM UTC+1, Irv Kalb wrote: >> >> The range function is discussed after that. >> > >FWIW range isn't a function in Python 3. From https://docs.python.org/3/library/functions.html#func-range

Re: Introducing the "for" loop

2017-10-05 Thread breamoreboy
On Friday, October 6, 2017 at 2:05:58 AM UTC+1, Irv Kalb wrote: > > The range function is discussed after that. > FWIW range isn't a function in Python 3. From https://docs.python.org/3/library/functions.html#func-range "Rather than being a function, range is actually an immutable sequence

Re: Introducing the "for" loop

2017-10-05 Thread Irv Kalb
> > As long as I have two teachers here, which textbooks are you using? I am > hoping to teach a college course in Python next fall. > > Thanks, > Bill > > At least one more. I teach Intro to Python courses at two colleges in Silicon Valley. These courses are aimed at students who have

Re: Introducing the "for" loop

2017-10-05 Thread Bill
Stefan Ram wrote: "ROGER GRAYDON CHRISTMAN" writes: On Wed, Oct 4, 2017 22:42 Stefan Ram (r...@zedat.fu-berlin.de) wrote: Steve D'Aprano writes: So, "bottom-up" in this case means: iterators should be taught before for-loops. Why? The easy answer

Re: Introducing the "for" loop

2017-10-05 Thread Peter Otten
Stefan Ram wrote: > "ROGER GRAYDON CHRISTMAN" writes: >>On Wed, Oct 4, 2017 22:42 Stefan Ram (r...@zedat.fu-berlin.de) wrote: >>Steve D'Aprano writes: So, "bottom-up" in this case means: iterators should be taught before for-loops. Why?