does lack of type declarations make Python unsafe?

Steven Taschuk staschuk at telusplanet.net
Thu Jun 19 11:16:01 EDT 2003


Quoth Brandon Corfman:
> Steven Taschuk wrote:
  [optional static typing]
> > Sounds fine to me.  Want to write the patch?  :)
> > 
> Ha, I think you're trying to trick me. :D [...]

Foiled again!

  [...]
> > But assignment is the quintessential side-effecty operation, nyet?
> > 
> Yes, of course, but to quote Paul Graham,
> "Having functional programming as an ideal doesn’t imply that programs 
> should never have side effects.It just means that they should have no 
> more than necessary." [1]

Ah.  Yes, a practical view rather than a strict theoretical one.
I follow now.

> Localizing side effects to passed-in & return values only makes it much 
> easier to track down bugs, IMO.  If you have too many member
> variables/globals holding state for your functions, then it becomes a 
> real problem to setup unit tests or to quickly evaluate success from the 
> command prompt.

An interesting point.  I think I agree; certainly an object with
oodles of state can be hard to work with.  But I wonder whether
that's due not so much to the state as to the complexity.  Simple
stateful objects -- such as iterators, say -- are not troublesome
in my experience.

-- 
Steven Taschuk                               staschuk at telusplanet.net
"What I find most baffling about that song is that it was not a hit."
                                          -- Tony Dylan Davis (CKUA)





More information about the Python-list mailing list