On Thu, Jul 19, 2007 at 08:48:55AM -0700, Steven Kurylo wrote:
> I've been dying to ask this since I started using python...
>
> "all variables found outside of the innermost scope are read-only
> (an attempt to write to such a variable will simply create a new local
> variable in the innermost scope, leaving the identically named outer
> variable unchanged)."
>
> Who ever thought that was a good idea?
I can't speak for the logic, perhaps Guido could answer that.
My assumption would be that it's intended to ensure side effect free code.
While I've done it many time (particularly in C), in some circles, it's
considered bad practice to pass a variable into a function and trust it to
do the right thing.
This is the way the string functional programmers like to do things, it
keeps things more loosely coupled. I like to bias my coding to this style
anyway so I've never found it a problem in python.
Received on Thu Jul 19 10:13:36 2007
This archive was generated by hypermail 2.1.8 : Thu Jul 19 2007 - 10:13:46 CST