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

Ian Kelly ian.g.kelly at gmail.com
Tue Jun 2 15:37:02 EDT 2015


On Tue, Jun 2, 2015 at 12:47 PM, Jon Ribbens
<jon+usenet at unequivocal.co.uk> 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).

Javascript has no problem putting primitives into containers.

js> var arr = [0, 'test', new Object()];
js> typeof arr[0]
"number"
js> typeof arr[1]
"string"
js> typeof arr[2]
"object"



More information about the Python-list mailing list