ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-tutor
python-tutor
[Tutor] class Knights vs class Knights(object)
by Wayne Werner other posts by this author
Nov 7 2009 9:12AM messages near this date
Re: [Tutor] Printing Sideway... | Re: [Tutor] class Knights vs class Knights(object)
Hi,

For class definitions I've always used

class Knights:

but I've just seen an example using:

class Knights(object):

So I did a quick little test and see this:

> >> a = Knights()
> >> b = Knights2()
> >> a
<__main__.Knights instance at 0xb7e12bec> 
> >> b
<__main__.Knights2 object at 0xb7e12b2c> 

and my question is what is the difference between the two? Is there a
difference other than one is an object the other is an instance? I googled
"python object vs. instance" and didn't find anything terribly useful.

Thanks,
Wayne

-- 
To be considered stupid and to be told so is more painful than being called
gluttonous, mendacious, violent, lascivious, lazy, cowardly: every weakness,
every vice, has found its defenders, its rhetoric, its ennoblement and
exaltation, but stupidity hasn�t. - Primo Levi
Thread:
Wayne Werner
Patrick Sabin

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved