Everything is an object in python - object class and type class

BartC bc at freeuk.com
Wed Jun 3 14:59:13 EDT 2015


On 03/06/2015 17:29, Mark Lawrence wrote:
> On 03/06/2015 17:00, BartC wrote:
>> On 03/06/2015 13:08, Marko Rauhamaa wrote:
>>> BartC <bc at freeuk.com>:
>>>
>>>> To 'variable' and 'type', you might need to add 'value' to make it more
>>>> complete.
>>>
>>> 'Value' and 'object' are indeed synonymous as long as you keep in mind
>>> that:
>>>
>>>      >>> -12 == -12
>>>      True
>>>      >>> -12 is -12
>>>      False
>>>
>>> IOW, the literal expression -12 happens to construct a fresh
>>> value/object each time CPython parses it.
>>
>> That's a different matter. However, you appear to be wrong.
>>
>> print (-12 is -12)
>>
>> gives True.

> No, you don't understand how cPython does things.

Do I need to understand CPython to appreciate what difference there 
might be between variables, values and objects?

Does anyone need to understand CPython for anything?

-- 
Bartc



More information about the Python-list mailing list