2009/12/23 <python-nl-requ...@python.org> > Send Python-nl mailing list submissions to > python-nl@python.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://mail.python.org/mailman/listinfo/python-nl > or, via email, send a message with subject or body 'help' to > python-nl-requ...@python.org > > You can reach the person managing the list at > python-nl-ow...@python.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Python-nl digest..." > > > Today's Topics: > > 1. Re: Python-nl Digest, Vol 67, Issue 5 (Hendrikus Godvliet) > 2. Re: Python-nl Digest, Vol 67, Issue 5 (Floris van Manen) > 3. Re: Python-nl Digest, Vol 67, Issue 5 (Floris van Manen) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 22 Dec 2009 12:23:34 +0100 > From: Hendrikus Godvliet <hendrikusgodvl...@gmail.com> > To: python-nl <python-nl@python.org> > Subject: Re: [python-nl] Python-nl Digest, Vol 67, Issue 5 > Message-ID: > <ec1c51360912220323h3bf2a96bt28591d2bd0229...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > Bedoel je dit? > > #! /user/bin/python > > def aftrekken(): > som_01 = 90 - 10 > return som_01 > > def optellen(): > som_02 = 10 + 10 > return som_02 > > def text_rekenen(): > text = """Hier zijn enkele berekeningen van de laatste opdrachten.""" > print text > > > text_rekenen() > print optellen() > print aftrekken() > > print optellen() + aftrekken() > print optellen() - aftrekken() > > Ja dit is wat ik bedoel en het werkt. Bedankt. > Volgende vraag. Om beter te leren begrijpen wat een class is en hoe het > werkt. Kan ik van de bovenstaande code ook een class maken? > > Gr Hendrikus > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://mail.python.org/pipermail/python-nl/attachments/20091222/ccae8386/attachment-0001.htm > > > > ------------------------------ > > Message: 2 > Date: Tue, 22 Dec 2009 12:31:12 +0100 > From: Floris van Manen <v...@klankschap.nl> > To: Dutch Python developers and users <python-nl@python.org> > Subject: Re: [python-nl] Python-nl Digest, Vol 67, Issue 5 > Message-ID: <d7ec9b51-1c45-4e16-9cd7-2a8604b8d...@klankschap.nl> > Content-Type: text/plain; charset=us-ascii > > class OpEnAf: > def __init__(self, v) > self.v = v > def erbij(self, x): > self.v += x > def eraf(self, x): > self.v -= x > def resultaat(self): > return self.v > > a = OpEnAf( 10 ) > print a.resultaat() > print a.v > > a.erbij(100) > print a.v > > a.eraf(20) > print a.v > > for i in range(10): > a.erbij(i) > print i, a.v > > print a.resultaat() > > > > > > On Dec 22, 2009, at 12:23, Hendrikus Godvliet wrote: > > > Bedoel je dit? > > > > #! /user/bin/python > > > > def aftrekken(): > > som_01 = 90 - 10 > > return som_01 > > > > def optellen(): > > som_02 = 10 + 10 > > return som_02 > > > > def text_rekenen(): > > text = """Hier zijn enkele berekeningen van de laatste opdrachten.""" > > print text > > > > > > text_rekenen() > > print optellen() > > print aftrekken() > > > > print optellen() + aftrekken() > > print optellen() - aftrekken() > > > > Ja dit is wat ik bedoel en het werkt. Bedankt. > > Volgende vraag. Om beter te leren begrijpen wat een class is en hoe het > werkt. Kan ik van de bovenstaande code ook een class maken? > > > > Gr Hendrikus > > > > > > > > _______________________________________________ > > Python-nl mailing list > > Python-nl@python.org > > http://mail.python.org/mailman/listinfo/python-nl > > > > ------------------------------ > > Message: 3 > Date: Tue, 22 Dec 2009 12:56:14 +0100 > From: Floris van Manen <v...@klankschap.nl> > To: Dutch Python developers and users <python-nl@python.org> > Subject: Re: [python-nl] Python-nl Digest, Vol 67, Issue 5 > Message-ID: <c454d680-93d0-412f-855a-548a4a2be...@klankschap.nl> > Content-Type: text/plain; charset=us-ascii > > > On Dec 22, 2009, at 12:31, Floris van Manen wrote: > > class OpEnAf: > def __init__(self, v) > self.v = v > def erbij(self, x): > self.v += x > def eraf(self, x): > self.v -= x > def show(self): > print 'Tussenstand:', self.v > > a = OpEnAf( 10 ) > a.show() > > a.erbij(100) > a.show() > > a.eraf(20) > a.show() > > for i in range(10): > a.erbij(i) > print i, 'erbij is', a.v > > a.show() > > > > > > ------------------------------ > > _______________________________________________ > Python-nl mailing list > Python-nl@python.org > http://mail.python.org/mailman/listinfo/python-nl > > > End of Python-nl Digest, Vol 67, Issue 6 > **************************************** >
Floris Bedankt voor de class uitleg. Heeft mij duidelijk gemaat hoe classes werken. In je code moet: class OpEnAf: def __init__(self, v) zo zijn: class OpEnAf: def __init__(self, v): Vriendelijke groet Hendrikus Godvliet
_______________________________________________ Python-nl mailing list Python-nl@python.org http://mail.python.org/mailman/listinfo/python-nl