Can a simple a==b 'hang' in and endless loop?

Steve Holden steve at holdenweb.com
Thu Jan 19 06:28:18 EST 2006


Claudio Grondi wrote:
> Steven D'Aprano wrote:
[...]
>>>The higher level of abstraction/indirection in Python results in making
>>>the concepts of 'value', 'having a value' or 'comparing values' useless,
>>>where it helps in C to express the difference between address and
>>>content at that address and to distinguish between the information
>>>telling _what_ is stored in memory and the information about _where_ it
>>>is stored.
>>
>>
>>In Python, you never care _where_ anything is stored. The id() function
>>returns the unique ID of an object, which as an implementation detail may
>>be the actual memory address, but that's just an implementation detail. In
>>any case, given a memory address, you can't do anything with that
>>knowledge.
> 
> 
> The question here is, if this a handicap or a welcome feature?
> 
A welcome feature, absolutely no doubt about it.

>  From the one side I am glad that Python cares about memory allocation 
> for me, but on the other side I have trouble to accept, that I have no 
> direct access to the memory area where data are stored in order to 
> manipulate them. Having this possibility would enormously speed up some 
> conversions, because it were possible to get them down to a redefinition 
> of the data structure without being forced to loop over the actual 
> content or use a special extension library written in C for doing that.
> 
Well, if this isn't a case of premature optimization I've never seen 
one. You apparently haven't yet written a single line of your 
appliction, yet you are already concerned about its efficiency.

1. First, make it work.

2. Then, if it doesn;t work fast enough, make it work faster.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list