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

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Jun 2 17:47:16 EDT 2015


On 02/06/2015 20:50, Ian Kelly wrote:
> On Tue, Jun 2, 2015 at 1:31 PM, Jon Ribbens
> <jon+usenet at unequivocal.co.uk> wrote:
>> On 2015-06-02, Dr. Bigcock <dreamingforward at gmail.com> wrote:
>>> On Tuesday, June 2, 2015 at 1:49:03 PM UTC-5, Jon Ribbens wrote:
>>>> On 2015-06-02, Dr. Bigcock <dreamingforward at gmail.com> wrote:
>>>>> It doesn't really do anything.  No one uses integers as objects.
>>>>> (Any dissenters?)
>>>>
>>>> Yes. *Everyone* uses integers as objects. Containers such as
>>>> lists and dictionaries and tuples etc contain objects. If
>>>> integers weren't objects then you wouldn't be able to put them
>>>> in containers (and you'd end up with Java).
>>>
>>> Sorry.  I meant "object" in the sense of OOP:  something you might
>>> extend or make a derived class with.
>>
>> I'm not sure you get to define which properties of objects you want
>> not to count.
>
> Accepting for the sake of argument that "something to be subclassed"
> is a reasonable definition of object, it should be pointed out that
> anybody who works with bools in Python is using integers as objects.
>
> The "Super Considered Harmful" essay also has a couple of examples of
> subclasses of int, and even just googling "python subclass int"
> demonstrates that there is plenty of interest in the subject.
>

The classic response to "Super Considered Harmful" for those who may be 
interested is 
https://rhettinger.wordpress.com/2011/05/26/super-considered-super/ and 
recently https://www.youtube.com/watch?v=EiOglTERPEo

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence




More information about the Python-list mailing list