Understanding python functions - Instant Python tutorial

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Fri Jul 13 21:20:06 EDT 2007


En Fri, 13 Jul 2007 13:41:39 -0300, Chris Carlen  
<crcarleRemoveThis at BOGUSsandia.gov> escribió:

> Ben Finney wrote:
>> Some languages have "variables", which act like boxes that have names
>> etched on the side. Once created, the box can contain an object, and
>> it can be inspected while in the box; to change the variable, you
>> throw out the object and put a different object in the same box.
>
> Yes, so y = x takes a copy of the stuff in the x box and puts it in the
> y box.  Which is what really happens in the hardware.

At least on some hardware, yes. Python namespaces are more like  
associative memories: you bind a tag (name) to a value, they have constant  
access time... But the real gain comes when you don't have to explicitely  
think step by step on *how* to do things, and can concentrate on a more  
abstract layer and say *what* you want to be done.

> I get it.  But I don't like it.  Yet.  Not sure how this will grow on me.
>
> A great deal of help, thanks.  Excellent explanation.  Wow.  This is
> strange.  A part of me wants to run and hide under the nearest 8-bit
> microcontroller.  But I will continue learning Python.

I think you will like it in the near future. But for someone coming from  
the microcontroller world, used to think closely in terms of the  
implementation, this may be a big paradigm shift.

-- 
Gabriel Genellina




More information about the Python-list mailing list