is None or == None ?

Rami Chowdhury rami.chowdhury at gmail.com
Fri Nov 6 15:19:14 EST 2009


On Fri, 06 Nov 2009 11:50:33 -0800, Alf P. Steinbach <alfps at start.no>  
wrote:

> * Rami Chowdhury:
>> On Fri, 06 Nov 2009 09:28:08 -0800, Alf P. Steinbach <alfps at start.no>  
>> wrote:
>>
>>> * Rami Chowdhury:
>>>> On Fri, 06 Nov 2009 08:54:53 -0800, Alf P. Steinbach <alfps at start.no>  
>>>> wrote:
>>>>
>>>>> But wow. That's pretty hare-brained: dynamic allocation for every  
>>>>> stored value outside the cache range, needless extra indirection for  
>>>>> every operation.
>>>>>
>>>>  Perhaps I'm not understanding this thread at all but how is dynamic  
>>>> allocation hare-brained, and what's the 'needless extra indirection'?
>>>
>>> Dynamic allocation isn't hare-brained, but doing it for every stored  
>>> integer value outside a very small range is, because dynamic  
>>> allocation is (relatively speaking, in the context of integer  
>>> operations) very costly even with a (relatively speaking, in the  
>>> context of general dynamic allocation) very efficient small-objects  
>>> allocator - here talking order(s) of magnitude.
>>  Well, sure, it may seem that way. But how large a cache would you want  
>> to preallocate? I can't see the average Python program needing to use  
>> the integers from -10000 to 10000, for instance. In my (admittedly  
>> limited) experience Python programs typically deal with rather more  
>> complex objects than plain integers.
>
> Uhm, you've misunderstood or failed to understand something basic, but  
> what?

Oh, I see, you were referring to a tagging scheme as an alternative. Sorry  
for the misunderstanding.

>
> Well it's an out-of-context quote, but t'was about creating the value  
> object that a variable contains a pointer to with the current CPython  
> implementation.
>

Again, perhaps I'm just misunderstanding what you're saying, but as I  
understand it, in CPython if you're looking for the value of a  
PyIntObject, that's stored right there in the structure, so no value  
object needs to be created...



-- 
Rami Chowdhury
"Never attribute to malice that which can be attributed to stupidity" --  
Hanlon's Razor
408-597-7068 (US) / 07875-841-046 (UK) / 0189-245544 (BD)



More information about the Python-list mailing list