Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'error:': 0.05; 'arguments': 0.07; 'constructor': 0.07; 'msg': 0.07; 'subject:help': 0.07; '__init__': 0.09; 'typed': 0.09; 'typeerror:': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'size,': 0.13; 'lot!': 0.16; 'underscores,': 0.16; 'wrote:': 0.17; 'subject:need': 0.17; 'sender:addr:gmail.com': 0.18; 'skip:" 30': 0.20; 'received:209.85.216.46': 0.21; 'color,': 0.22; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'looks': 0.26; '(most': 0.27; 'message-id:@mail.gmail.com': 0.27; 'ball': 0.29; 'url:mailman': 0.29; 'class': 0.29; 'url:python': 0.32; 'file': 0.32; 'print': 0.32; 'url:listinfo': 0.32; '11,': 0.33; 'traceback': 0.33; 'guys': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'direction': 0.35; 'robert': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'should': 0.36; 'received:209': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'takes': 0.39; 'url:mail': 0.40; 'kindly': 0.67; 'color': 0.69; 'day': 0.73; '2013': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=CyMBBZQ6XXQtxjxyRcthks5uFC6X6r+iZTDjloEkrgA=; b=qwaO5Ty5st+RN+bUldpK83Bl291OP+CjLrIFXmdNnApFQAjsmDAO+pmFWzZCN6lH9U 5Dfmdzl1ptg98oIhfo6XF5fHgF8RZKWKZ1cFRs8/Zz7qkJJZZD6Hv4wivN5dxIZ3YMBs fwTJs2PhKUp2j0LDC5LyG6vjPxucjilLCWv3mfoKutBcPoW8NFg6Vlizg78XF1+ux1Kn r1Qv5Xs35RsF2+bTzRh5CLsy67L2wVx1+aSkEH8fuFUyWZqpfL4bV5+Xd4N1hdwSbSgZ UjMl4kZH/HTvFvzWQdcwtQD0QC2bygDbN6LJ+BM9FanaJvbnFbCGqgg4s4v+YPuCGk1/ za8A== MIME-Version: 1.0 X-Received: by 10.49.24.135 with SMTP id u7mr20659490qef.4.1362166884717; Fri, 01 Mar 2013 11:41:24 -0800 (PST) Sender: robertkday@gmail.com In-Reply-To: <8B3DE2FF-3A5A-4666-8FF6-70B15AAF5987@icloud.com> References: <8B3DE2FF-3A5A-4666-8FF6-70B15AAF5987@icloud.com> Date: Fri, 1 Mar 2013 19:41:24 +0000 X-Google-Sender-Auth: HYKi7zFXf39um3-53Z3T4IvuW7U Subject: Re: need for help From: Rob Day To: leonardo selmi Content-Type: text/plain; charset=ISO-8859-1 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 38 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1362166892 news.xs4all.nl 6965 [2001:888:2000:d::a6]:46436 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:40286 It looks like you're using single underscores, not double: the methods should be __init__ and __str__. On 1 March 2013 18:35, leonardo selmi wrote: > hi guys > > i typed the following program: > > class ball: > def _init_(self, color, size, direction): > self.color = color > self.size = size > self.direction = direction > > def _str_(self): > msg = 'hi, i am a ' + self.size + ' ' + self.color + 'ball!' > return msg > > myball = ball('red', 'small', 'down') > print my ball > > BUT I GOT THIS ERROR: > > Traceback (most recent call last): > File "/Users/leonardo/Documents/ball2.py", line 11, in > myball = ball('red', 'small', 'down') > TypeError: this constructor takes no arguments > > can you kindly tell me what is wrong? > thanks a lot! > -- > http://mail.python.org/mailman/listinfo/python-list -- Robert K. Day robert.day@merton.oxon.org