about __str__

Bruno Desthuilliers bruno.42.desthuilliers at wtf.websiteburo.oops.com
Fri Sep 21 03:39:44 EDT 2007


Konstantinos Pachopoulos a écrit :
> Hi,
> i have the following class:
> ===========================================
> class CmterIDCmts:      
      def __init__(self,commiterID,commits):
>        self.commiterID_=long(commiterID)
>        self.commits_=long(commits)
>      
>    def __str__(self):
>        s=""
>        s+="<"+str(self.commiterID_)+":"+str(self.commits_)+">"
>        return s

def __str__(self):
   return "<%s:%s>" % (self.commiterID_, self.commits_)





More information about the Python-list mailing list