Re: Python book question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D'Arcy J.M. Cain

    Re: Python book question

    On Fri, 16 May 2008 10:31:16 -0500
    Matt Herzog <msh@blisses.or gwrote:
    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@druid.ne t | 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.
Working...