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

Marco Buttu marco.buttu at gmail.com
Wed Jun 3 08:10:58 EDT 2015


On 03/06/2015 13:08, BartC wrote:

> Come on, we're trying to keep this simple.

If we really want to keep it simple, we can take this starting point:

http://en.wikipedia.org/wiki/Object_(computer_science)

If we agree with the Wikipedia definition:

``In the class-based object-oriented programming paradigm, "object" 
refers to a particular instance of a class...``

than we can say in Python everything is an object, because everything is 
an instance of a class. And  of course, object is synonimous for instance:

 >>> (1, 2, 3).foo
Traceback (most recent call last):
    ...
AttributeError: 'tuple' object has no attribute 'foo'

-- 
Marco Buttu

INAF-Osservatorio Astronomico di Cagliari
Via della Scienza n. 5, 09047 Selargius (CA)
Phone: 070 711 80 217
Email: mbuttu at oa-cagliari.inaf.it




More information about the Python-list mailing list