Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91615

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <random832@fastmail.us>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'methods,': 0.09; 'received:internal': 0.09; 'repr': 0.09; 'semantics': 0.09; 'python': 0.11; 'subject:python': 0.14; 'output': 0.15; 'above)': 0.16; 'message-id:@webmail.messagingengine.com': 0.16; 'object()': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.212': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:66.111.4.27': 0.16; 'received:messagingengine.com': 0.16; 'received:out3-smtp.messagingengine.com': 0.16; 'subject:class': 0.16; 'subject:object': 0.16; 'subject:type': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'trying': 0.22; 'meant': 0.22; '31,': 0.22; 'actual': 0.29; "i'm": 0.29; 'str': 0.29; 'objects': 0.29; 'implement': 0.32; 'class': 0.33; 'to:addr:python-list': 0.35; 'instance': 0.35; 'created': 0.36; 'there': 0.36; 'received:10': 0.37; 'subject:: ': 0.37; 'received:66': 0.38; 'mean': 0.38; 'method': 0.39; 'does': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'called': 0.40; 'from:no real name:2**0': 0.61; 'default': 0.61; 'provide': 0.61; 'header:Message-Id:1': 0.62; 'act': 0.63; 'inherit': 0.66; 'yourself': 0.73
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.us; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=Nam 4pmtPQP/VenUsMYhwErxO7NU=; b=j9lxEWET2c3NwFjXootFvPZa2c8NMnfLntd D/ZrMuqCSyHZuAwa1BueQmDDhBGlDgeF8tsYuB34lo4Wta8DMW9eSOi8RniJhwqt b78F3XQvE6IcI37zbKU4vdcZozmsugEV+TfwMUqrPuQsSdwhQJOs/SqiPSt0apQ1 67D6sv3Q=
DKIM-Signature v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=Nam4pmtPQP/VenUsMYhwErxO7NU=; b=qgI9t fSVi/lvsM6vtYfHujUXLDYqzsb2Hibcabrab79/6nTiVsNjLiw6jIIr2i44YLvdl Ny7i+EQ81lKzdSrRuy92YcjPFkpZpnwoKtmiUPlSq+LyfrkppXduU24snWEc4B3C iHF0r0GBAblRUZk1wz3LAwCnMb2Ed3ZU2rYQDI=
X-Sasl-Enc DriIHK3tQLVtNPXeOX4O5t88Y5xsIj1SSztYay50EMTt 1433131050
From random832@fastmail.us
To python-list@python.org
MIME-Version 1.0
Content-Transfer-Encoding 7bit
Content-Type text/plain
X-Mailer MessagingEngine.com Webmail Interface - ajax-073992ec
Subject Re: Everything is an object in python - object class and type class
Date Sun, 31 May 2015 23:57:30 -0400
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.262.1433133429.5151.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1433133429 news.xs4all.nl 2930 [2001:888:2000:d::a6]:48791
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91615

Show key headers only | View raw


On Sun, May 31, 2015, at 10:34, Eddilbert Macharia wrote:
> Hello All ,
> 
> I'm wrecking my head trying to understand. where the class object comes
> into play . 
> 
> Is it only meant to act as base class and does it mean there is an actual
> class called object in python which all the objects created using the
> class type inherit ?

Well, you _can_ create a proper instance if you want.

>>> x = object()
>>> x # incidentally, the repr method is called to produce this output
<object object at 0x1003b8090>
>>> id(x)
4298866832
>>> hash(x)
268679177

The other thing that object does is provide the default implementations
of these methods, so when you inherit from it you don't have to
implement them yourself (equality semantics based on object identity,
str based on repr, repr as shown above)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Everything is an object in python - object class and type class random832@fastmail.us - 2015-05-31 23:57 -0400

csiph-web