Python book question
D'Arcy J.M. Cain
darcy at druid.net
Fri May 16 11:52:14 EDT 2008
On Fri, 16 May 2008 10:31:16 -0500
Matt Herzog <msh at blisses.org> wrote:
> Since Python is the only language that doesn't give me headaches I thought this book might be good. Has anyone read it or can anyone recommend the author? Can anyone recommend a better Data Structures and Algorithms book?
>
> The book: http://www.fbeedle.com/053-9.html
I'm not familiar with the book but I poked my head in and looked at the
first example:
def squareroot(n):
root = n/2
for k in range(20):
root = (1.0/2)*(root + (n / root))
return root
Looks fine and works but I wonder about the "root = n/2" line. Since
the behaviour of this operation changes in 3.0, shouldn't it be
specific about whether it is doing int or float division?
--
D'Arcy J.M. Cain <darcy at druid.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
More information about the Python-list
mailing list