Re: Need reviews for my book on introductory python

2017-01-27 Thread Steve D'Aprano
On Sat, 28 Jan 2017 03:12 pm, D'Arcy Cain wrote:

> I can't believe how many typos and grammar errors there are in this
> thread by people correcting typos and grammar.


That's practically a law of physics: the Iron Law of Nitpicking, better
known as Muphry's Law.

https://en.wikipedia.org/wiki/Muphry's_law



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread Rustom Mody
On Thursday, January 26, 2017 at 7:55:57 AM UTC+5:30, Sandeep Nagar wrote:
> Hi,
> 
> A few month ago I wrote a book on introductory python based on my experinces 
> while teaching python to Bachelor students of engineering. It is now 
> available in e-book and paperback format at Amazon. 
> 
> https://www.amazon.com/dp/1520153686
> 
> The book is written for beginners of python programming language and written 
> in learn-by-doing manner. If some group members can review the same, it will 
> be useful for myself to come up with an improved version.
> 
> Other similar books of mine are based on Octave and Scilab with following 
> links:
> 
> https://www.amazon.com/dp/152015111X (Scilab)
> 
> https://www.amazon.com/dp/1520158106 (Octave)
> 
> If you are interested in open source computing, please have a look. 

Friendly advice: Write a blog instead of, or at least before writing a book
Sure there are disadvantages... which are IMHO minor/unrealistic:
eg YOur intended audience has no access to internet. About as unrealistic as
them not having access to electricity

Advantages
- Very low bar on entry
- Much finer granularity — one post vs one book
- Much tighter write→feedback→correct cycle: Minor corrections can be just 
edited in/out. Major additions get a new post
- More current medium “Medium is the message (or massage)!”
- Saves trees

[Personal note: I started blogging on programming related topics a few years 
ago:
http://blog.languager.org/
Which crossed 50K hits a few months ago.
More gratifying, Ive received comments and thanks from people like Doug 
McIllroy, co-creator of Unix]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread D'Arcy Cain

On 2017-01-27 11:01 PM, Terry Reedy wrote:

This is a run-on sentence, which is to say, two sentences.  Change
'suntax,' to 'syntax.' and 'in' to ' In'.

   ^^
I can't believe how many typos and grammar errors there are in this 
thread by people correcting typos and grammar.


And please don't say "suntax".  The government hasn't thought of that 
one yet.  Don't give them ideas.


--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@vex.net
VoIP: sip:da...@vex.net
--
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread Terry Reedy

On 1/27/2017 6:12 PM, Ian Kelly wrote:

On Jan 27, 2017 2:13 PM, "bob gailer"  wrote:

On 1/26/2017 8:05 PM, Sandeep Nagar wrote:


Hi

As I mentioned, a scaled down version is available for free at
bookmuft.Com which can be used to judge in this case.


Maybe I am blind, but I don't see any mention of bookmuft.Co.


I pulled up the PDF from bookmuft.com (which I also do not see mentioned in
the original post).

2.1 page 15:

"For example, suppose line 5 of a python program has syntax error, in this
case the program will executes all commands till line 4 and will then show
an error."


This is a run-on sentence, which is to say, two sentences.  Change 
'suntax,' to 'syntax.' and 'in' to ' In'.



This is factually incorrect. A program with a syntax error will not be
executed at all.

The description of the Python interpreter is also pretty far from the
truth. The interpreter does not read Python source code one line at a time
as described. The interpreter only reads Python bytecode. At the point that
the interpreter starts reading bytecode, the Python compiler has already
compiled the entire source file into bytecode.

This description only applies to CPython. Other Python implementations may
work differently.

Page 17:

"When the programs compose of hundreds and thousands of lines, a
compilation process will yield a faster result because the object code
needs to be only compiled once and then run directly on microprocessor.
Whereas an interpreted code will check for interpretations each time it
needs to be processed."


"When programs are composed of ..."



Again, it's only Python byte code that is interpreted. The actual Python
source is compiled and does not need to be reprocessed each time a line of
code is executed.

3.2, page 21:

"logical: This type of data stores boolean values True or False boolean
values and can be operated by boolean operators like AND, OR etc."

The type is named "bool", not "logical".

"Most programming languages use the values 1 or 0 for boolean values but
python differs in this approach."

It's not really important, but I disagree with that assessment of "most
programming languages", at least in regard to modern or high-level ones.

3.3, page 22:

"There are four types of numeric data types" (listing int, long, float and
complex)


In 3.x, 'int' was delected and 'long' was renamed 'int'.

I strongly suggest that the next version be written for 3.x with 
2.x-only info either deleted or relegated to footnotes (or parenthetical 
notes).



--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread Ethan Furman

On 01/27/2017 03:11 PM, Erik wrote:

On 27/01/17 21:36, MRAB wrote:



"loose"? Don't you mean "lose"? (Or possible "lack"?)


Don't you mean 'Or possibly "lack"'?


And this is why books should be reviewed and edited /before publishing/.  ;)

--
~Ethan~
--
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread Ian Kelly
On Jan 27, 2017 2:13 PM, "bob gailer"  wrote:

On 1/26/2017 8:05 PM, Sandeep Nagar wrote:

> Hi
>
> As I mentioned, a scaled down version is available for free at
> bookmuft.Com which can be used to judge in this case.
>
Maybe I am blind, but I don't see any mention of bookmuft.Co.


I pulled up the PDF from bookmuft.com (which I also do not see mentioned in
the original post).

2.1 page 15:

"For example, suppose line 5 of a python program has syntax error, in this
case the program will executes all commands till line 4 and will then show
an error."

This is factually incorrect. A program with a syntax error will not be
executed at all.

The description of the Python interpreter is also pretty far from the
truth. The interpreter does not read Python source code one line at a time
as described. The interpreter only reads Python bytecode. At the point that
the interpreter starts reading bytecode, the Python compiler has already
compiled the entire source file into bytecode.

This description only applies to CPython. Other Python implementations may
work differently.

Page 17:

"When the programs compose of hundreds and thousands of lines, a
compilation process will yield a faster result because the object code
needs to be only compiled once and then run directly on microprocessor.
Whereas an interpreted code will check for interpretations each time it
needs to be processed."

Again, it's only Python byte code that is interpreted. The actual Python
source is compiled and does not need to be reprocessed each time a line of
code is executed.

3.2, page 21:

"logical: This type of data stores boolean values True or False boolean
values and can be operated by boolean operators like AND, OR etc."

The type is named "bool", not "logical".

"Most programming languages use the values 1 or 0 for boolean values but
python differs in this approach."

It's not really important, but I disagree with that assessment of "most
programming languages", at least in regard to modern or high-level ones.

3.3, page 22:

"There are four types of numeric data types" (listing int, long, float and
complex)

You left out Decimal and Fraction.

3.3.1: "Python has arbitrary precision for float, long, complex, hence the
limit to length of these numbers is subject to availability of memory"

Uh, no, that's only true for long. A Python float only has the same
precision as a C double. Same for complex but there are two components,
each with the precision of a C double.

3.3.2, page 24:

"The issue with floating point number based arithmetic is that the answer
is an approximation of real number since real numbers are defined for 10 as
their base whereas computer works with numbers where 2 is used as the base."

This is also incorrect. The definition of real numbers has nothing
whatsoever to do with base 10, and there are plenty of real numbers that
still could not be represented exactly even if float used decimal digits
instead of binary digits, and even if it did have arbitrary precision. For
example, 1/3. For another example, pi.

"Above calculation shows that 0.123_2 = 0.135_10."

Say what? First of all, 0.123 isn't even a valid number in binary. The only
digits available in base 2 are 0 and 1. Secondly, even if we ignore that,
the result of 1/2  + 2/2^2 + 3/2^3 = 1.375, not 0.135.

Page 25:

"One can use the decimal module which has a function Decimal() that returns
the number as stored by the computer."

That is not even close to an accurate description. First, Decimal is a
type, not a function. It differs from float in two important respects: one,
it uses a base-ten representation instead of base two; two, it actually
does have arbitrary precision. Also, it does not return the number as
stored by the computer. It's a completely separate implementation of real
numbers.

"As seen above, Decimal(0.123) occupies 72 bits and hence is more accurate
approximation as compared to 0.123 which occupies 24 bits"

Bytes, not bits. But also, Decimal(0.123) is no more accurate an
approximation than 0.123 because you constructed it from 0.123 which is
already an approximation. It's actually the exact same approximation.
Garbage in, garbage out. Decimal("0.123") on the other hand (note the use
of a string rather than a float as the constructor argument) denotes
exactly the real number 0.123.

3.4, page 26:

All of the information in this section about characters and encodings is
specific to strings and does not pertain to sequences generally.

"Python also deal with characters using data type string, list, tuple."

List and tuple have nothing to do with characters.

3.6, page 28:

"Mapping is a scheme of defining data where each element is identified with
a key called ”hash tag”."

I think you mean "hash value". A hash tag is something one uses when
posting on Twitter.

Page 29:

"In example above, we created a dictionary containing two characters a and
b identified by two keys 1 and 10."

In the example given, 'a' and 'b' are the keys and 1 and 10 are 

Re: Need reviews for my book on introductory python

2017-01-27 Thread Erik

On 27/01/17 21:36, MRAB wrote:

"loose"? Don't you mean "lose"? (Or possible "lack"?)


Don't you mean 'Or possibly "lack"'?

https://en.wikipedia.org/wiki/Muphry%27s_law ;)

E.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread Ray Cote
On Fri, Jan 27, 2017 at 4:18 PM, mm0fmf  wrote:

> On 27/01/2017 20:17, bob gailer wrote:
>
>> On 1/25/2017 9:25 PM, Sandeep Nagar wrote:
>>
>>> Hi,
>>>
>>> A few month ago I wrote a book on introductory python based on my
>>> experinces while teaching python to Bachelor students of engineering.
>>> It is now available in e-book and paperback format at Amazon.
>>>
>>> https://www.amazon.com/dp/1520153686
>>>
>>> The book is written for beginners of python programming language and
>>> written in learn-by-doing manner. If some group members can review the
>>> same, it will be useful for myself to come up with an improved version.
>>>
>> Who is the publisher of this book?
>>
>> I just took a look at the pages that can be viewed on Amazon. Many
>> reactions. it is hard for me to write this, as it seems it would sound
>> harsh, judgemental, unappreciative. But you did ask for a review, and
>> this is my honest reaction.
>>
>> I find it hard to read a book written by a non-native speaker of
>> English. I an constantly having to overlook what to me are spelling,
>> grammatical and vocabulary errors. I HIGHLY recommend you find an editor
>> who can fix these errors.
>>
>> Snap. I found it impossible to read and never got to the Python parts. It
> is not written in English. Most of the pronouns and conjunctions are
> missing. It looks like it has not been proof-read as words loose
> capitalisation, many are mis-spelt and grammar rules regarding plural cases
> and agreement are just ignored.
>
>
In addition to what other’s have said:
- congrats on taking the time to write a book and put it out for others.
- Introduction to Python section 2.1 starts with C example. Seems out of
place.
- Search inside the book has 0 results for iterator -- how do you do Python
without iterators?
- Two references to generator, but they are random number generator
references.
- Was confused by the switching in and out of numpy usage.
- And yes, Python3 is the way to go. Been writing Python since 1.5 and
about 90% of my new code is Python 3.5.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread MRAB

On 2017-01-27 21:18, mm0fmf wrote:

On 27/01/2017 20:17, bob gailer wrote:

On 1/25/2017 9:25 PM, Sandeep Nagar wrote:

Hi,

A few month ago I wrote a book on introductory python based on my
experinces while teaching python to Bachelor students of engineering.
It is now available in e-book and paperback format at Amazon.

https://www.amazon.com/dp/1520153686

The book is written for beginners of python programming language and
written in learn-by-doing manner. If some group members can review the
same, it will be useful for myself to come up with an improved version.

Who is the publisher of this book?

I just took a look at the pages that can be viewed on Amazon. Many
reactions. it is hard for me to write this, as it seems it would sound
harsh, judgemental, unappreciative. But you did ask for a review, and
this is my honest reaction.

I find it hard to read a book written by a non-native speaker of
English. I an constantly having to overlook what to me are spelling,
grammatical and vocabulary errors. I HIGHLY recommend you find an editor
who can fix these errors.


Snap. I found it impossible to read and never got to the Python parts.
It is not written in English. Most of the pronouns and conjunctions are
missing. It looks like it has not been proof-read as words loose
capitalisation, many are mis-spelt and grammar rules regarding plural
cases and agreement are just ignored.


"loose"? Don't you mean "lose"? (Or possible "lack"?)

--
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread mm0fmf

On 27/01/2017 20:17, bob gailer wrote:

On 1/25/2017 9:25 PM, Sandeep Nagar wrote:

Hi,

A few month ago I wrote a book on introductory python based on my
experinces while teaching python to Bachelor students of engineering.
It is now available in e-book and paperback format at Amazon.

https://www.amazon.com/dp/1520153686

The book is written for beginners of python programming language and
written in learn-by-doing manner. If some group members can review the
same, it will be useful for myself to come up with an improved version.

Who is the publisher of this book?

I just took a look at the pages that can be viewed on Amazon. Many
reactions. it is hard for me to write this, as it seems it would sound
harsh, judgemental, unappreciative. But you did ask for a review, and
this is my honest reaction.

I find it hard to read a book written by a non-native speaker of
English. I an constantly having to overlook what to me are spelling,
grammatical and vocabulary errors. I HIGHLY recommend you find an editor
who can fix these errors.

Snap. I found it impossible to read and never got to the Python parts. 
It is not written in English. Most of the pronouns and conjunctions are 
missing. It looks like it has not been proof-read as words loose 
capitalisation, many are mis-spelt and grammar rules regarding plural 
cases and agreement are just ignored.






--
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread Jon Ribbens
On 2017-01-27, D'Arcy Cain  wrote:
> On 2017-01-27 03:17 PM, bob gailer wrote:
>> sudo apt-get won't work on Windows. Tell the reader that this is how to
>> do it in Unix, and show the Windows equivalent.
>
> Actually it doesn't work on Unix either.  It only works on Linux.

Actually it doesn't work on Linux either.  It only works on
Debian-derived systems.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread D'Arcy Cain

On 2017-01-27 03:17 PM, bob gailer wrote:

sudo apt-get won't work on Windows. Tell the reader that this is how to
do it in Unix, and show the Windows equivalent.


Actually it doesn't work on Unix either.  It only works on Linux.

--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:da...@vex.net
VoIP: sip:da...@vex.net
--
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread bob gailer

On 1/25/2017 9:25 PM, Sandeep Nagar wrote:

Hi,

A few month ago I wrote a book on introductory python based on my experinces 
while teaching python to Bachelor students of engineering. It is now available 
in e-book and paperback format at Amazon.

https://www.amazon.com/dp/1520153686

The book is written for beginners of python programming language and written in 
learn-by-doing manner. If some group members can review the same, it will be 
useful for myself to come up with an improved version.

Who is the publisher of this book?

I just took a look at the pages that can be viewed on Amazon. Many 
reactions. it is hard for me to write this, as it seems it would sound 
harsh, judgemental, unappreciative. But you did ask for a review, and 
this is my honest reaction.


I find it hard to read a book written by a non-native speaker of 
English. I an constantly having to overlook what to me are spelling, 
grammatical and vocabulary errors. I HIGHLY recommend you find an editor 
who can fix these errors.


When I pick up an "Introduction to ." book I expect to get right 
into the language. History, interpreted vs compiled, examples in C, if 
included at all should go in an appendix.


I think you should be teaching Python 3 rather than 2. I disagree with 
your reasons for sticking with ver 2.
I, as a developer using Python for over 10 years, welcomed ver 3 and now 
use it exclusively.


Last sentence of 2.2 is confusing.

Section 2.3 you need to tell reader how to obtain a python prompt. The 
example is also confusing, since to most python users it looks like:

>>> 2+4
6

The result of 2+4. does not appear.

sudo apt-get won't work on Windows. Tell the reader that this is how to 
do it in Unix, and show the Windows equivalent.


I would avoid showing from xxx import * as it is likely to cause 
confusion when a module so imported overwrites a built-in.


Bottom of p 23 (sys.sizeof(). How would a python newbie know to import sys?

I will stop here - there are many other issues.

I am, by degree, an engineer. If this were my introduction to python I 
probably would walk away from python, discouraged by how hard it is to 
learn.

--
https://mail.python.org/mailman/listinfo/python-list


Re: Need reviews for my book on introductory python

2017-01-27 Thread bob gailer

On 1/26/2017 8:05 PM, Sandeep Nagar wrote:

Hi

As I mentioned, a scaled down version is available for free at 
bookmuft.Com which can be used to judge in this case.

Maybe I am blind, but I don't see any mention of bookmuft.Co.


Regards

On Jan 27, 2017 05:02, "bob gailer" > wrote:


On 1/25/2017 9:25 PM, Sandeep Nagar wrote:

Hi,

A few month ago I wrote a book on introductory python based on
my experinces while teaching python to Bachelor students of
engineering. It is now available in e-book and paperback
format at Amazon.

https://www.amazon.com/dp/1520153686


The book is written for beginners of python programming
language and written in learn-by-doing manner. If some group
members can review the same, it will be useful for myself to
come up with an improved version.

I'd like to review it, but am reluctant to put out money for a
copy! How about offering a review copy at no charge?


Other similar books of mine are based on Octave and Scilab
with following links:

https://www.amazon.com/dp/152015111X
 (Scilab)

https://www.amazon.com/dp/1520158106
 (Octave)

If you are interested in open source computing, please have a
look.

Also please do share the link for print books with your
colleagues at other universities and recommend them for
libraries and researchers, if you feel that they can be
helpful to them.

Regards

Sandeep



-- 
Image and video hosting by TinyPic





--
Image and video hosting by TinyPic
--
https://mail.python.org/mailman/listinfo/python-list


Re: How coding in Python is bad for you

2017-01-27 Thread Nathan Ernst
I used to manually reformat unfamiliar C++ by hand, if for no other reason
in that it forced me to read the code and somewhat comprehend what was
going on. Now, I've lost my patience and use clang-format, a great & highly
configurable tool. I also use vim for Python & C++ coding, so I also rely
upon the command "gg=G" to reformat the current file (this doesn't do much
in Python, however).

One of the things I like about python is the indentation. It almost forces
(or rather strongly encourages you) to keep functions short & sweet, to do
a single thing in a function, and avoid too deeply nested structures.

I've seen horrible abominations in C++ over the years. In separate
projects, I've seen functions that were, in one case, over 45 printed
pages, another over 65 pages. The nesting level was way too deep. I think
in the worst case there were 8 levels of nested loops. This was problematic
for many reasons. Multiple developers working on this function at the same
time and attempting to merge was a big problem - the diff tool used by
Clearcase (I know, a WTF, in of itself) would get confused and
occassionally omit closing braces. Good luck resolving a compilation error
by a missing brace in a 5000 line function.  As a result of the pain I've
experienced, I try and keep functions small enough to fit on a
half-vertical, half-horizontal screen, with no line-wraps on a 1080p
monitor. (I'm usually working in a terminal half-screen wide and use
vertical splits in vim to see different parts of a file, or different
files).

On Fri, Jan 27, 2017 at 4:54 AM, Cecil Westerhof  wrote:

> On Friday 27 Jan 2017 05:07 CET, Brandon McCaig wrote:
>
> > Hell, considering the code that I have seen in the wild it might
> > even catch some extra errors that become syntax errors! It's not
> > at all rare for indentation to not match in languages that don't
> > require it to at least fit a pattern.
>
> I remember that when I had to amend the code of a certain programmer I
> always needed half a day to reformat his code. Because he was very
> good in copy/paste, but I could not made head or tail of his code
> because of the zig-zag of his code.
>
> That is why I immediately like the indent rule of Python very much.
>
> My only ‘problem’ was that I used to put debug statement at the
> beginning of a line to see immediately what the debug statements
> where. But that was a small price to pay. ;-)
>
> --
> Cecil Westerhof
> Senior Software Engineer
> LinkedIn: http://www.linkedin.com/in/cecilwesterhof
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Referencing section name by interpolation in ConfigParser

2017-01-27 Thread Hans-Peter Jansen
On Mittwoch, 25. Januar 2017 10:01:56 Peter Otten wrote:
> Hans-Peter Jansen wrote:
> > I would like to use a interpolated section name, e.g.:
> > 
> > [Section]
> > secref: %{section}s/whatever
> > 
> > should result in:
>  config['Section']['secref']
> > 
> > 'Section/whatever'
> > 
> > Any idea anybody, how to archive this with minimum fuzz?
> 
> If you can live with the existing "basic interpolation", i. e. %(...)s, not
> %{...}s:

Yes, of course.. Sorry for the typo.

> $ cat config.ini
> [Foo]
> secref: %(section)s/whatever
> [Bar]
> secref: %(section)s/whatever
> $ cat demo.py
> import configparser
> 
> 
> class Interpolation(configparser.BasicInterpolation):
> def before_get(self, parser, section, option, value, defaults):
> defaults = defaults.copy()
> defaults["section"] = section
> return super().before_get(parser, section, option, value, defaults)
> 
> 
> p = configparser.ConfigParser(interpolation=Interpolation())
> p.read("config.ini")
> for section in "Foo", "Bar":
> print(section, "-->", p[section]["secref"])
> $ python3 demo.py
> Foo --> Foo/whatever
> Bar --> Bar/whatever
> $

Brilliant as usual, thank you, Peter.

This is exactly, what I was after.

Have a nice weekend,
Pete
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How coding in Python is bad for you

2017-01-27 Thread Cecil Westerhof
On Friday 27 Jan 2017 05:07 CET, Brandon McCaig wrote:

> Hell, considering the code that I have seen in the wild it might
> even catch some extra errors that become syntax errors! It's not
> at all rare for indentation to not match in languages that don't
> require it to at least fit a pattern.

I remember that when I had to amend the code of a certain programmer I
always needed half a day to reformat his code. Because he was very
good in copy/paste, but I could not made head or tail of his code
because of the zig-zag of his code.

That is why I immediately like the indent rule of Python very much.

My only ‘problem’ was that I used to put debug statement at the
beginning of a line to see immediately what the debug statements
where. But that was a small price to pay. ;-)

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof
-- 
https://mail.python.org/mailman/listinfo/python-list