Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-20 Thread Alf P. Steinbach
Hi, 10 details I forgot in my first response... * John Posner: [...] Chapter 2, which current runs 98 pages! The chapter 2 PDF I posted on http://tinyurl.com/programmingbookP3> was and is (it's not been updated) 101 pages, with an "-EOT-" at page 102. I suspect you may have read the previ

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-20 Thread Steven D'Aprano
On Sun, 20 Dec 2009 08:29:43 +0100, Alf P. Steinbach wrote: > I recently (just weeks > ago) was astounded to see that a C++ "expert" thought that Java had pass > by reference, apparently because in Java only references are passed > around. The Java community, for some bizarre reason, has a tenden

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-19 Thread Alf P. Steinbach
* John Posner: On Fri, 18 Dec 2009 13:00:48 -0500, Alf P. Steinbach wrote: Chapter 2 is about Basic Concepts (of programming). It's the usual: variables, ... 1. Overall suggestion You have a tendency to include non-pertinent asides [1]. But then, rambling a bit endows a manuscript with

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-19 Thread John Posner
On Fri, 18 Dec 2009 13:00:48 -0500, Alf P. Steinbach wrote: Chapter 2 is about Basic Concepts (of programming). It's the usual: variables, ... 1. Overall suggestion You have a tendency to include non-pertinent asides [1]. But then, rambling a bit endows a manuscript with the author's

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
* Steven D'Aprano: On Sat, 19 Dec 2009 04:29:22 +0100, Alf P. Steinbach wrote: * Steven D'Aprano: On Sat, 19 Dec 2009 01:25:48 +0100, Alf P. Steinbach wrote: That said, and a bit off-tangent to your comment's main thrust, the time spent on coding that repeated-division-by-2 optimization woul

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
* Steven D'Aprano: On Sat, 19 Dec 2009 04:04:51 +0100, Alf P. Steinbach wrote: * Steven D'Aprano: On Fri, 18 Dec 2009 19:00:48 +0100, Alf P. Steinbach wrote: In fact almost no Python code does, but then it seems that people are not aware of how many of their names are constants and think tha

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Steven D'Aprano
On Sat, 19 Dec 2009 04:29:22 +0100, Alf P. Steinbach wrote: > * Steven D'Aprano: >> On Sat, 19 Dec 2009 01:25:48 +0100, Alf P. Steinbach wrote: >> >>> That said, and a bit off-tangent to your comment's main thrust, the >>> time spent on coding that repeated-division-by-2 optimization would, I >>>

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Mensanator
On Dec 19, 12:21 am, "Alf P. Steinbach" wrote: > * Mensanator: > > > > >> That said, and a bit off-tangent to your comment's main thrust, the time > >> spent > >> on coding that repeated-division-by-2 optimization would, I think, be > >> better > >> spent googling "Collatz Conjecture"  --  avoid

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
* Mensanator: That said, and a bit off-tangent to your comment's main thrust, the time spent on coding that repeated-division-by-2 optimization would, I think, be better spent googling "Collatz Conjecture" -- avoiding writing /any/ code. ;-) Ha! I know more about Collatz than you can ever fi

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Mensanator
On Dec 18, 6:25 pm, "Alf P. Steinbach" wrote: > * Mensanator: > > >> The second deviation is that since most names are constants, > > > Really? Does that mean you don't use literals, to save the time > > required to convert them to integers? Isn't that done at compile > > time? > > > So, instead o

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Steven D'Aprano
On Sat, 19 Dec 2009 04:04:51 +0100, Alf P. Steinbach wrote: > * Steven D'Aprano: >> On Fri, 18 Dec 2009 19:00:48 +0100, Alf P. Steinbach wrote: >> >>> In fact almost no Python >>> code does, but then it seems that people are not aware of how many of >>> their names are constants and think that th

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Steven D'Aprano
On Fri, 18 Dec 2009 21:29:27 -0600, John Bokma wrote: > Steven D'Aprano writes: > >> CPython 2.5 and on has a keyhole optimizer that replaces many constant > ^^^ > Shouldn't that be peephole? Alternate names for the same thing. >> expressions with pre-computed va

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Gregory Ewing
Mensanator wrote: Really? Does that mean you don't use literals, to save the time required to convert them to integers? I think all he means is that when he *does* use a named constant, he spells it in lower case rather than upper case, e.g. 'twopi' rather than 'TWOPI'. I don't think there's a

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Steven D'Aprano
On Fri, 18 Dec 2009 15:26:05 -0800, Mensanator wrote: >> The second deviation is that since most names are constants, > > Really? Does that mean you don't use literals, to save the time required > to convert them to integers? Isn't that done at compile time? > > So, instead of doing the Collatz

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
* Steven D'Aprano: On Sat, 19 Dec 2009 01:25:48 +0100, Alf P. Steinbach wrote: That said, and a bit off-tangent to your comment's main thrust, the time spent on coding that repeated-division-by-2 optimization would, I think, be better spent googling "Collatz Conjecture" -- avoiding writing /a

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread John Bokma
Steven D'Aprano writes: > CPython 2.5 and on has a keyhole optimizer that replaces many constant ^^^ Shouldn't that be peephole? > expressions with pre-computed values. And that's called constant folding. Unless I misread your post (or have been out of touch wit

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
* Steven D'Aprano: On Fri, 18 Dec 2009 19:00:48 +0100, Alf P. Steinbach wrote: In fact almost no Python code does, but then it seems that people are not aware of how many of their names are constants and think that they're uppercasing constants when in fact they're not. E.g. routine arguments

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Steven D'Aprano
On Sat, 19 Dec 2009 01:25:48 +0100, Alf P. Steinbach wrote: > That said, and a bit off-tangent to your comment's main thrust, the time > spent on coding that repeated-division-by-2 optimization would, I think, > be better spent googling "Collatz Conjecture" -- avoiding writing > /any/ code. ;-)

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Steven D'Aprano
On Fri, 18 Dec 2009 19:00:48 +0100, Alf P. Steinbach wrote: > In fact almost no Python > code does, but then it seems that people are not aware of how many of > their names are constants and think that they're uppercasing constants > when in fact they're not. E.g. routine arguments Routine argum

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
* Mensanator: The second deviation is that since most names are constants, Really? Does that mean you don't use literals, to save the time required to convert them to integers? Isn't that done at compile time? So, instead of doing the Collatz Conjecture as while a>1: f = gmpy.scan1(a,0) i

Re: Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Mensanator
> The second deviation is that since most names are constants, Really? Does that mean you don't use literals, to save the time required to convert them to integers? Isn't that done at compile time? So, instead of doing the Collatz Conjecture as while a>1: f = gmpy.scan1(a,0) if f>0: a =

Programming intro book ch1 and ch2 (Windows/Python 3) - Request For Comments

2009-12-18 Thread Alf P. Steinbach
I finally finished (draft), I believe!, chapter 2... Chapter 1 gets the reader up & running, i.e. it's "Hello, world!", basic tool usage, without discussing anything about programming really. One reaction to this chapter, based on the two example programs in it, was that it wasn't gradual and