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
Re: [Tutor] Classes that do operator overloading
by Hugo Arts other posts by this author
Nov 7 2009 3:38AM messages near this date
Re: [Tutor] Classes that do operator overloading | Re: [Tutor] Classes that do operator overloading
On Sat, Nov 7, 2009 at 12:25 PM, C.T. Matsumoto <tmatsumoto@[...].net>  wrote:
>  Thanks Hugo,
> 
>  Do methods like __add__, __del__, count as built-in types? I'm aware of the
>  rule you explained and use it and that's why when  I saw:
> 

Built-in types are only those classes 'built in' to the python
interpreter. They include int, float, str, list, dict, tuple, and
others. Every class you define yourself (and also most classes in the
standard library) should have a Capitalized class name, no matter what
kind of methods you define for it.

>  class indexer():
>     def ___getitem__(self, index):
>         return index ** 2
> 
>  I thought I was missing some special style, or rule. The class above is take
>  from Learning Python, and there are several other examples too.
> 

following the PEP 8 guidelines, that class should have been named Indexer.
_______________________________________________
Tutor maillist  -  Tutor@[...].org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
Thread:
C.T. Matsumoto
Alan Gauld
Alan Gauld
Alan Gauld
Spir
C.T. Matsumoto
Hugo Arts
C.T. Matsumoto
Hugo Arts
Tim Golden

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