Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #26490 > unrolled thread
| Started by | Jean Dubois <jeandubois314@gmail.com> |
|---|---|
| First post | 2012-08-04 08:49 -0700 |
| Last post | 2012-08-07 11:23 +0100 |
| Articles | 20 on this page of 70 — 18 participants |
Back to article view | Back to comp.lang.python
[newbie] Looking for a good introduction to object oriented programming with Python Jean Dubois <jeandubois314@gmail.com> - 2012-08-04 08:49 -0700
Re: [newbie] Looking for a good introduction to object oriented programming with Python shearichard@gmail.com - 2012-08-04 17:11 -0700
Re: Looking for a good introduction to object oriented programming with Python Jean Dubois <jeandubois314@gmail.com> - 2012-08-05 05:38 -0700
Re: Looking for a good introduction to object oriented programming with Python Jean Dubois <jeandubois314@gmail.com> - 2012-08-05 11:04 -0700
Re: Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-05 19:28 +0100
Re: Looking for a good introduction to object oriented programming with Python Jean Dubois <jeandubois314@gmail.com> - 2012-08-06 07:56 -0700
Re: Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-06 17:17 +0100
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 01:12 +0000
Re: Looking for a good introduction to object oriented programming with Python Ben Finney <ben+python@benfinney.id.au> - 2012-08-07 11:23 +1000
Re: Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-07 08:49 +0100
Re: Looking for a good introduction to object oriented programming with Python Roy Smith <roy@panix.com> - 2012-08-05 14:39 -0400
Re: Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-05 19:53 +0100
Re: Looking for a good introduction to object oriented programming with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-05 18:45 -0400
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-05 22:51 +0000
Re: Looking for a good introduction to object oriented programming with Python Roy Smith <roy@panix.com> - 2012-08-05 19:12 -0400
Re: Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-06 00:30 +0100
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-06 00:27 +0000
Re: Looking for a good introduction to object oriented programming with Python Dan Sommers <dan@tombstonezero.net> - 2012-08-05 17:50 -0700
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 08:48 +0100
Re: Looking for a good introduction to object oriented programming with Python DJC <djc@news.invalid> - 2012-08-06 11:20 +0200
Re: Looking for a good introduction to object oriented programming with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-05 20:57 -0400
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 08:43 +0100
Re: Looking for a good introduction to object oriented programming with Python Roy Smith <roy@panix.com> - 2012-08-06 09:16 -0400
Re: Looking for a good introduction to object oriented programming with Python Wolfgang Strobl <news4@mystrobl.de> - 2012-08-06 08:18 +0200
Re: [newbie] Looking for a good introduction to object oriented programming with Python dncarac@gmail.com - 2012-08-05 11:59 -0700
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-05 20:46 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-05 23:11 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Roy Smith <roy@panix.com> - 2012-08-05 18:53 -0400
Re: [newbie] Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-06 00:22 +0000
Re: [newbie] Looking for a good introduction to object oriented programming with Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-06 02:02 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-05 21:14 -0400
Re: [newbie] Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-06 06:08 +0000
Re: [newbie] Looking for a good introduction to object oriented programming with Python Paul Rubin <no.email@nospam.invalid> - 2012-08-06 00:25 -0700
Re: Looking for a good introduction to object oriented programming with Python alex23 <wuwei23@gmail.com> - 2012-08-05 19:44 -0700
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 19:02 +0000
Re: Looking for a good introduction to object oriented programming with Python Terry Reedy <tjreedy@udel.edu> - 2012-08-07 18:37 -0400
Re: Looking for a good introduction to object oriented programming with Python alex23 <wuwei23@gmail.com> - 2012-08-07 17:07 -0700
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-08 02:14 +0000
Re: Looking for a good introduction to object oriented programming with Python Chris Angelico <rosuav@gmail.com> - 2012-08-08 12:24 +1000
Re: Looking for a good introduction to object oriented programming with Python alex23 <wuwei23@gmail.com> - 2012-08-07 20:20 -0700
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 09:55 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 10:24 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 05:35 +0000
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 09:16 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 05:19 +0000
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 10:19 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Ben Finney <ben+python@benfinney.id.au> - 2012-08-07 23:12 +1000
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 15:13 +0100
Re: [newbie] Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 14:14 +0000
Re: [newbie] Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 15:34 +0100
Re: Looking for a good introduction to object oriented programming with Python rusi <rustompmody@gmail.com> - 2012-08-07 08:04 -0700
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 18:00 +0100
Re: Looking for a good introduction to object oriented programming with Python Chris Angelico <rosuav@gmail.com> - 2012-08-08 07:57 +1000
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-08 10:51 +0100
Re: Looking for a good introduction to object oriented programming with Python rusi <rustompmody@gmail.com> - 2012-08-08 09:27 -0700
Re: Looking for a good introduction to object oriented programming with Python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-08 17:28 +0000
Re: Looking for a good introduction to object oriented programming with Python Chris Angelico <rosuav@gmail.com> - 2012-08-09 11:32 +1000
Re: Looking for a good introduction to object oriented programming with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-08 12:42 -0400
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-08 20:31 +0100
Re: Looking for a good introduction to object oriented programming with Python Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-08 22:59 -0400
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-09 08:29 +0100
Geneology Packages -- WAS: Looking for a good introduction to object oriented programming with Python Simon Cropper <simoncropper@fossworkflowguides.com> - 2012-08-09 13:51 +1000
Re: Geneology Packages Ben Finney <ben+python@benfinney.id.au> - 2012-08-09 14:00 +1000
Re: Looking for a good introduction to object oriented programming with Python rusi <rustompmody@gmail.com> - 2012-08-06 05:19 -0700
Re: Looking for a good introduction to object oriented programming with Python lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 15:27 +0100
Re: Looking for a good introduction to object oriented programming with Python rusi <rustompmody@gmail.com> - 2012-08-06 09:34 -0700
Re: Looking for a good introduction to object oriented programming with Python Chris Angelico <rosuav@gmail.com> - 2012-08-07 08:44 +1000
OT probably but still relevant (was Re: Looking for a good introduction to object oriented programming with Python) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-06 17:23 +0100
Re: OT probably but still relevant (was Re: Looking for a good introduction to object oriented programming with Python) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-08-07 09:44 +0000
Re: OT probably but still relevant (was Re: Looking for a good introduction to object oriented programming with Python) lipska the kat <lipskathekat@yahoo.co.uk> - 2012-08-07 11:23 +0100
Page 1 of 4 [1] 2 3 4 Next page →
| From | Jean Dubois <jeandubois314@gmail.com> |
|---|---|
| Date | 2012-08-04 08:49 -0700 |
| Subject | [newbie] Looking for a good introduction to object oriented programming with Python |
| Message-ID | <54b916fe-9e2d-4f9e-b533-b5ecf677c8a5@a19g2000vba.googlegroups.com> |
I'm looking for a good introduction to object oriented programming with Python. I am looking for an introduction which only refers to Python. I have seen introductions where the authors make comparisons to other languages such as C++ and Java, but as I don't know these languages that doesn't help me further much, it rather confuses me. I also found an introduction in which the author started by telling that "object oriented programming is weird", such a statement did stop me reading further as I think an author should at least believe in the topic he is going to present as being logical. If someone here has a link or title to such an intro, I'd appreciate that very much regards, Jean p.s. People who don't like my style of asking questions, please neglect this message
[toc] | [next] | [standalone]
| From | shearichard@gmail.com |
|---|---|
| Date | 2012-08-04 17:11 -0700 |
| Message-ID | <ab728c00-411d-4e25-a4e6-fbec496963c1@googlegroups.com> |
| In reply to | #26490 |
One reason you may be having difficulty is that unlike some languages (C++/Java) object-orientation is not a be all and end all in Python, in fact you could work with Python for a long time without really 'doing it' at all (well other than calling methods/properties on existing API's). Having said that here's what I would suggest ... Could do worse than this : http://www.diveintopython.net/object_oriented_framework/index.html and this http://docs.python.org/tutorial/classes.html read together. Judging by your question this is a probably a little advanced for now but you could bookmark it for the future: http://www.catonmat.net/blog/learning-python-design-patterns-through-video-lectures/ Here's the corresponding PDF to go with the video: http://assets.en.oreilly.com/1/event/45/Practical%20Python%20Patterns%20Presentation.pdf
[toc] | [prev] | [next] | [standalone]
| From | Jean Dubois <jeandubois314@gmail.com> |
|---|---|
| Date | 2012-08-05 05:38 -0700 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <62867318-098a-4f35-9582-5c9084e595d6@u17g2000yqa.googlegroups.com> |
| In reply to | #26514 |
On 5 aug, 02:11, shearich...@gmail.com wrote: > One reason you may be having difficulty is that unlike some languages (C++/Java) object-orientation is not a be all and end all in Python, in fact you could work with Python for a long time without really 'doing it' at all (well other than calling methods/properties on existing API's). Having said that here's what I would suggest ... > > Could do worse than this : > > http://www.diveintopython.net/object_oriented_framework/index.html > > and this > > http://docs.python.org/tutorial/classes.html > > read together. > > Judging by your question this is a probably a little advanced for now but you could bookmark it for the future: > > http://www.catonmat.net/blog/learning-python-design-patterns-through-... > > Here's the corresponding PDF to go with the video: > > http://assets.en.oreilly.com/1/event/45/Practical%20Python%20Patterns... Thanks a lot for this information, I'll check it out the following days best regards, Jean
[toc] | [prev] | [next] | [standalone]
| From | Jean Dubois <jeandubois314@gmail.com> |
|---|---|
| Date | 2012-08-05 11:04 -0700 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <8f1b60a5-0411-4aae-9ee6-0025b493ca2d@m13g2000vbd.googlegroups.com> |
| In reply to | #26514 |
On 5 aug, 02:11, shearich...@gmail.com wrote: > One reason you may be having difficulty is that unlike some languages (C++/Java) object-orientation is not a be all and end all in Python, in fact you could work with Python for a long time without really 'doing it' at all (well other than calling methods/properties on existing API's). Having said that here's what I would suggest ... > > Could do worse than this : > > http://www.diveintopython.net/object_oriented_framework/index.html > This example seems to tell you need the concept of dictionaries to explain object oriented programming, is this really necessary? > and this > > http://docs.python.org/tutorial/classes.html Unfortunately, the trouble with this explanation is exactly what made me ask the original question: it starts from concepts in c++ making it very hard to understand for someone who does not know that language already. > > read together. > > Judging by your question this is a probably a little advanced for now but you could bookmark it for the future: > > http://www.catonmat.net/blog/learning-python-design-patterns-through-... > > Here's the corresponding PDF to go with the video: > > http://assets.en.oreilly.com/1/event/45/Practical%20Python%20Patterns... Can someone here on this list give a trivial example of what object oriented programming is, using only Python? thanks in advance Jean
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2012-08-05 19:28 +0100 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <mailman.2966.1344191242.4697.python-list@python.org> |
| In reply to | #26540 |
On 05/08/2012 19:04, Jean Dubois wrote: > On 5 aug, 02:11, shearich...@gmail.com wrote: >> One reason you may be having difficulty is that unlike some languages (C++/Java) object-orientation is not a be all and end all in Python, in fact you could work with Python for a long time without really 'doing it' at all (well other than calling methods/properties on existing API's). Having said that here's what I would suggest ... >> >> Could do worse than this : >> >> http://www.diveintopython.net/object_oriented_framework/index.html >> > This example seems to tell you need the concept of dictionaries to > explain object oriented programming, is this really necessary? >> and this >> >> http://docs.python.org/tutorial/classes.html > Unfortunately, the trouble with this explanation is exactly what made > me ask the original question: it starts from concepts in c++ making it > very hard to understand for someone who does not know that language > already. >> >> read together. >> >> Judging by your question this is a probably a little advanced for now but you could bookmark it for the future: >> >> http://www.catonmat.net/blog/learning-python-design-patterns-through-... >> >> Here's the corresponding PDF to go with the video: >> >> http://assets.en.oreilly.com/1/event/45/Practical%20Python%20Patterns... > Can someone here on this list give a trivial example of what object > oriented programming is, using only Python? > > thanks in advance > Jean > Try this http://www.voidspace.org.uk/python/articles/OOP.shtml ??? -- Cheers. Mark Lawrence.
[toc] | [prev] | [next] | [standalone]
| From | Jean Dubois <jeandubois314@gmail.com> |
|---|---|
| Date | 2012-08-06 07:56 -0700 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <94492584-4446-47ff-85c4-749de850561e@b10g2000vbj.googlegroups.com> |
| In reply to | #26542 |
On 5 aug, 20:28, Mark Lawrence <breamore...@yahoo.co.uk> wrote:
> On 05/08/2012 19:04, Jean Dubois wrote:
>
>
>
>
>
>
>
>
>
> > On 5 aug, 02:11, shearich...@gmail.com wrote:
> >> One reason you may be having difficulty is that unlike some languages (C++/Java) object-orientation is not a be all and end all in Python, in fact you could work with Python for a long time without really 'doing it' at all (well other than calling methods/properties on existing API's). Having said that here's what I would suggest ...
>
> >> Could do worse than this :
>
> >>http://www.diveintopython.net/object_oriented_framework/index.html
>
> > This example seems to tell you need the concept of dictionaries to
> > explain object oriented programming, is this really necessary?
> >> and this
>
> >>http://docs.python.org/tutorial/classes.html
> > Unfortunately, the trouble with this explanation is exactly what made
> > me ask the original question: it starts from concepts in c++ making it
> > very hard to understand for someone who does not know that language
> > already.
>
> >> read together.
>
> >> Judging by your question this is a probably a little advanced for now but you could bookmark it for the future:
>
> >>http://www.catonmat.net/blog/learning-python-design-patterns-through-...
>
> >> Here's the corresponding PDF to go with the video:
>
> >>http://assets.en.oreilly.com/1/event/45/Practical%20Python%20Patterns...
> > Can someone here on this list give a trivial example of what object
> > oriented programming is, using only Python?
>
> > thanks in advance
> > Jean
>
> Try thishttp://www.voidspace.org.uk/python/articles/OOP.shtml???
>
> --
> Cheers.
>
> Mark Lawrence.
Thanks, this one is a lot better. Could you just tell me what the use
is of the following lines:
"""Class docstring."""
"""Method docstring."""
"""Method docstring."""
Taken from the following code fragment (I really want to understand
every bit of code, and the author doesn't mention this)
class OurClass(object):
"""Class docstring."""
def __init__(self, arg1, arg2):
"""Method docstring."""
self.arg1 = arg1
self.arg2 = arg2
def printargs(self):
"""Method docstring."""
print self.arg1
print self.arg2
thanks in advance
jean
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2012-08-06 17:17 +0100 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <mailman.3017.1344269795.4697.python-list@python.org> |
| In reply to | #26623 |
Please see my comment at the bottom hint hint :) On 06/08/2012 16:38, Ramchandra Apte wrote: > Its a docstring - it documents the function/class > Did you know that docstrings can be used for testing - look at the doctest > standard library module! > try: > > class A: > def method(self): > '''Sample method > This method does the difficult task X. > Call this method with no arguments.'''#docstring > pass > > then type : > > help(A.method) > > And viola! > On 6 August 2012 20:26, Jean Dubois <jeandubois314@gmail.com> wrote: > >> On 5 aug, 20:28, Mark Lawrence <breamore...@yahoo.co.uk> wrote: >>> On 05/08/2012 19:04, Jean Dubois wrote: >>> >>> >>> >>> >>> >>> >>> >>> >>> >>>> On 5 aug, 02:11, shearich...@gmail.com wrote: >>>>> One reason you may be having difficulty is that unlike some languages >> (C++/Java) object-orientation is not a be all and end all in Python, in >> fact you could work with Python for a long time without really 'doing it' >> at all (well other than calling methods/properties on existing API's). >> Having said that here's what I would suggest ... >>> >>>>> Could do worse than this : >>> >>>>> http://www.diveintopython.net/object_oriented_framework/index.html >>> >>>> This example seems to tell you need the concept of dictionaries to >>>> explain object oriented programming, is this really necessary? >>>>> and this >>> >>>>> http://docs.python.org/tutorial/classes.html >>>> Unfortunately, the trouble with this explanation is exactly what made >>>> me ask the original question: it starts from concepts in c++ making it >>>> very hard to understand for someone who does not know that language >>>> already. >>> >>>>> read together. >>> >>>>> Judging by your question this is a probably a little advanced for now >> but you could bookmark it for the future: >>> >>>>> http://www.catonmat.net/blog/learning-python-design-patterns-through-. >> .. >>> >>>>> Here's the corresponding PDF to go with the video: >>> >>>>> http://assets.en.oreilly.com/1/event/45/Practical%20Python%20Patterns. >> .. >>>> Can someone here on this list give a trivial example of what object >>>> oriented programming is, using only Python? >>> >>>> thanks in advance >>>> Jean >>> >>> Try thishttp://www.voidspace.org.uk/python/articles/OOP.shtml??? >>> >>> -- >>> Cheers. >>> >>> Mark Lawrence. >> Thanks, this one is a lot better. Could you just tell me what the use >> is of the following lines: >> """Class docstring.""" >> """Method docstring.""" >> """Method docstring.""" >> Taken from the following code fragment (I really want to understand >> every bit of code, and the author doesn't mention this) >> >> >> class OurClass(object): >> """Class docstring.""" >> >> def __init__(self, arg1, arg2): >> """Method docstring.""" >> self.arg1 = arg1 >> self.arg2 = arg2 >> >> def printargs(self): >> """Method docstring.""" >> print self.arg1 >> print self.arg2 >> >> >> >> thanks in advance >> jean >> -- >> http://mail.python.org/mailman/listinfo/python-list >> > > > Ramchandra Apte will you please stop top posting. In your native language you may well but from bottom to top, but this news group prefers reading top to bottom :) Thanks. -- Cheers. Mark Lawrence.
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2012-08-07 01:12 +0000 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <50206b82$0$29978$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #26633 |
On Mon, 06 Aug 2012 17:17:33 +0100, Mark Lawrence wrote: > Please see my comment at the bottom hint hint :) Please trim unnecessary quoted text. We don't need to see the entire thread of comment/reply/reply-to-reply duplicated in *every* email. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Date | 2012-08-07 11:23 +1000 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <87a9y7jy0g.fsf@benfinney.id.au> |
| In reply to | #26669 |
Steven D'Aprano <steve+comp.lang.python@pearwood.info> writes: > Please trim unnecessary quoted text. > > We don't need to see the entire thread of comment/reply/reply-to-reply > duplicated in *every* email. s/every/any/ -- \ “If you make people think they're thinking, they'll love you; | `\ but if you really make them think, they'll hate you.” —Donald | _o__) Robert Perry Marquis | Ben Finney
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2012-08-07 08:49 +0100 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <mailman.3044.1344325704.4697.python-list@python.org> |
| In reply to | #26669 |
On 07/08/2012 02:12, Steven D'Aprano wrote: > On Mon, 06 Aug 2012 17:17:33 +0100, Mark Lawrence wrote: > >> Please see my comment at the bottom hint hint :) > > Please trim unnecessary quoted text. > > We don't need to see the entire thread of comment/reply/reply-to-reply > duplicated in *every* email. > > Point taken, sorry. -- Cheers. Mark Lawrence.
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2012-08-05 14:39 -0400 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <roy-795145.14391005082012@news.panix.com> |
| In reply to | #26540 |
In article
<8f1b60a5-0411-4aae-9ee6-0025b493ca2d@m13g2000vbd.googlegroups.com>,
Jean Dubois <jeandubois314@gmail.com> wrote:
> Can someone here on this list give a trivial example of what object
> oriented programming is, using only Python?
OOP seems to mean different things to different people. What OOP means
to you is usually a strong function of whatever OOP language you learned
first. That being said, I think the fundamental, universal, core
principle of OOP is that an object contains some data, and some code
that knows how to do something with that data.
So, to give you a simple (but real-life) example, the system I'm working
in now has User objects. A user is a pretty complicated class, but
here's some simple methods from it:
def __eq__(self, other):
return isinstance(other, (User, AnonymousUser)) \
and self.user_id == other.user_id
def __unicode__(self):
return self.username
def __repr__(self):
return '<User %d: %r>' % (self.user_id, self.username)
This defines a few basic behaviors for User objects.
First, it defines how to tell if something is equal to a given User
object. The something must itself be a User (ignore the minor
complication about AnonymousUser for the moment), and it must have the
same user_id as this one. I could easily imagine lots of other possible
ways two users could be considered equal (same username, for example),
but we're using user_id. This means I can write:
if user1 == user2:
print "they're the same"
and I don't have to worry about (or even know about) the details. In
fact, sometime long after I've written that code, somebody could define
some new kind of HighSecurityUser which tests for equality by comparing
the scanned retina images for both of them. My code wouldn't have to
change; it would magically just start enforcing retina matching.
Likewise, I can write:
print user
or
logger.warning("%r did something interesting", user)
and I don't have to know anything about how to print a User. The User
knows how to print itself.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2012-08-05 19:53 +0100 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <mailman.2969.1344192625.4697.python-list@python.org> |
| In reply to | #26540 |
On 05/08/2012 19:43, Ifthikhan Nazeem wrote: [top posting fixed] > > On Sun, Aug 5, 2012 at 8:28 PM, Mark Lawrence <breamoreboy@yahoo.co.uk>wrote: > >> On 05/08/2012 19:04, Jean Dubois wrote: >> >>> On 5 aug, 02:11, shearich...@gmail.com wrote: >>> >>>> One reason you may be having difficulty is that unlike some languages >>>> (C++/Java) object-orientation is not a be all and end all in Python, in >>>> fact you could work with Python for a long time without really 'doing it' >>>> at all (well other than calling methods/properties on existing API's). >>>> Having said that here's what I would suggest ... >>>> >>>> Could do worse than this : >>>> >>>> http://www.diveintopython.net/**object_oriented_framework/**index.html<http://www.diveintopython.net/object_oriented_framework/index.html> >>>> >>>> This example seems to tell you need the concept of dictionaries to >>> explain object oriented programming, is this really necessary? >>> >>>> and this >>>> >>>> http://docs.python.org/**tutorial/classes.html<http://docs.python.org/tutorial/classes.html> >>>> >>> Unfortunately, the trouble with this explanation is exactly what made >>> me ask the original question: it starts from concepts in c++ making it >>> very hard to understand for someone who does not know that language >>> already. >>> >>>> >>>> read together. >>>> >>>> Judging by your question this is a probably a little advanced for now >>>> but you could bookmark it for the future: >>>> >>>> http://www.catonmat.net/blog/**learning-python-design-** >>>> patterns-through-.<http://www.catonmat.net/blog/learning-python-design-patterns-through-.> >>>> .. >>>> >>>> Here's the corresponding PDF to go with the video: >>>> >>>> http://assets.en.oreilly.com/**1/event/45/Practical%20Python%** >>>> 20Patterns.<http://assets.en.oreilly.com/1/event/45/Practical%20Python%20Patterns.> >>>> .. >>>> >>> Can someone here on this list give a trivial example of what object >>> oriented programming is, using only Python? >>> >>> thanks in advance >>> Jean >>> >>> >> Try this http://www.voidspace.org.uk/**python/articles/OOP.shtml<http://www.voidspace.org.uk/python/articles/OOP.shtml>??? >> >> -- >> Cheers. >> >> Mark Lawrence. >> >> -- >> http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list> >> > > I would recommend Bruce Eckel's Thining in Python. Check it out here > http://www.mindview.net/Books/TIPython/ > > I'd forgotten about that so thanks for the reminder. -- Cheers. Mark Lawrence.
[toc] | [prev] | [next] | [standalone]
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
|---|---|
| Date | 2012-08-05 18:45 -0400 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <mailman.2983.1344206762.4697.python-list@python.org> |
| In reply to | #26540 |
On Sun, 5 Aug 2012 11:04:36 -0700 (PDT), Jean Dubois
<jeandubois314@gmail.com> declaimed the following in
gmane.comp.python.general:
> Unfortunately, the trouble with this explanation is exactly what made
> me ask the original question: it starts from concepts in c++ making it
> very hard to understand for someone who does not know that language
> already.
Then maybe you are asking the wrong question...
Don't look for Object-Oriented Programming -- since the first widely
popular OOP language was C++ (Smalltalk was earlier, but rather
specialized, whereas C++ started as a preprocessor for C).
Rather look for Object-Oriented Analysis and Design (OOAD). An OOAD
textbook /should/ be language neutral and, these days, likely using the
constructs/notation of UML [which derived from a merger of two or three
separate proposals for OOAD tools]
An OOAD text should cover, besides Classes, Use Cases, state
diagrams, and lots of other things...
The short view of a Class is that it is a means of encapsulating the
methods (functions/operations) of an object along with the attributes
(data) of a specific instance of the class.
A Radio Class would define methods to change the volume, power
state, tuning, and band. These methods are common to all radios. But an
instance of a radio doesn't share its volume level with all other
instances of the Radio class.
OOP is more a style/philosophy of programming by using "objects".
Ada 95 is an OOP language but didn't have the
"object.method(parameters)" syntax (one had to use "method(object,
parameters", but the language could determine which of similar named
methods was meant based upon the type of "object" and the types of the
parameters).
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2012-08-05 22:51 +0000 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <501ef904$0$29867$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #26577 |
On Sun, 05 Aug 2012 18:45:47 -0400, Dennis Lee Bieber wrote: > Don't look for Object-Oriented Programming -- since the first widely > popular OOP language was C++ (Smalltalk was earlier, but rather > specialized, whereas C++ started as a preprocessor for C). > > Rather look for Object-Oriented Analysis and Design (OOAD). An OOAD > textbook /should/ be language neutral and, these days, likely using the > constructs/notation of UML [which derived from a merger of two or three > separate proposals for OOAD tools] Good lord. I'd rather read C++ than UML. And I can't read C++. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Roy Smith <roy@panix.com> |
|---|---|
| Date | 2012-08-05 19:12 -0400 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <roy-220E4F.19123405082012@news.panix.com> |
| In reply to | #26579 |
In article <501ef904$0$29867$c3e8da3$5496439d@news.astraweb.com>, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > On Sun, 05 Aug 2012 18:45:47 -0400, Dennis Lee Bieber wrote: > > > Don't look for Object-Oriented Programming -- since the first widely > > popular OOP language was C++ (Smalltalk was earlier, but rather > > specialized, whereas C++ started as a preprocessor for C). > > > > Rather look for Object-Oriented Analysis and Design (OOAD). An OOAD > > textbook /should/ be language neutral and, these days, likely using the > > constructs/notation of UML [which derived from a merger of two or three > > separate proposals for OOAD tools] > > Good lord. I'd rather read C++ than UML. And I can't read C++. UML is under-rated. I certainly don't have any love of the 47 different flavors of diagram, but the basic idea of having a common graphical language for describing how objects and classes interact is pretty useful. Just don't ask me to remember which kind of arrowhead I'm supposed to use in which situation.
[toc] | [prev] | [next] | [standalone]
| From | Mark Lawrence <breamoreboy@yahoo.co.uk> |
|---|---|
| Date | 2012-08-06 00:30 +0100 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <mailman.2986.1344209358.4697.python-list@python.org> |
| In reply to | #26580 |
On 06/08/2012 00:12, Roy Smith wrote: > In article <501ef904$0$29867$c3e8da3$5496439d@news.astraweb.com>, > Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > >> On Sun, 05 Aug 2012 18:45:47 -0400, Dennis Lee Bieber wrote: >> >>> Don't look for Object-Oriented Programming -- since the first widely >>> popular OOP language was C++ (Smalltalk was earlier, but rather >>> specialized, whereas C++ started as a preprocessor for C). >>> >>> Rather look for Object-Oriented Analysis and Design (OOAD). An OOAD >>> textbook /should/ be language neutral and, these days, likely using the >>> constructs/notation of UML [which derived from a merger of two or three >>> separate proposals for OOAD tools] >> >> Good lord. I'd rather read C++ than UML. And I can't read C++. > > UML is under-rated. I certainly don't have any love of the 47 different > flavors of diagram, but the basic idea of having a common graphical > language for describing how objects and classes interact is pretty > useful. Just don't ask me to remember which kind of arrowhead I'm > supposed to use in which situation. > Ask nicely and I'll lend you my copy of Martin Fowler's UML Distilled which covers "version 1.2 OMG UML standard". What's it up to now, version 17.38? -- Cheers. Mark Lawrence.
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve+comp.lang.python@pearwood.info> |
|---|---|
| Date | 2012-08-06 00:27 +0000 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <501f0f7e$0$29867$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #26580 |
On Sun, 05 Aug 2012 19:12:35 -0400, Roy Smith wrote: >> Good lord. I'd rather read C++ than UML. And I can't read C++. > > UML is under-rated. I certainly don't have any love of the 47 different > flavors of diagram, but the basic idea of having a common graphical > language for describing how objects and classes interact is pretty > useful. Just don't ask me to remember which kind of arrowhead I'm > supposed to use in which situation. I frequently draw diagrams to understand the relationships between my classes and the problem I am trying to solve. I almost invariably use one type of box and one type of arrowhead. Sometimes if I'm bored I draw doodles on the diagram. If only I could remember to be consistent about what doodle I draw where, I too could be an UML guru. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Dan Sommers <dan@tombstonezero.net> |
|---|---|
| Date | 2012-08-05 17:50 -0700 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <mailman.2988.1344214230.4697.python-list@python.org> |
| In reply to | #26588 |
On 2012-08-06 at 00:27:43 +0000, Steven D'Aprano <steve+comp.lang.python@pearwood.info> wrote: > I frequently draw diagrams to understand the relationships between my > classes and the problem I am trying to solve. I almost invariably use one > type of box and one type of arrowhead. Sometimes if I'm bored I draw > doodles on the diagram. If only I could remember to be consistent about > what doodle I draw where, I too could be an UML guru. +1
[toc] | [prev] | [next] | [standalone]
| From | lipska the kat <lipskathekat@yahoo.co.uk> |
|---|---|
| Date | 2012-08-06 08:48 +0100 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <7LWdncgebNUu64LNnZ2dnUVZ8vydnZ2d@bt.com> |
| In reply to | #26588 |
On 06/08/12 01:27, Steven D'Aprano wrote: > On Sun, 05 Aug 2012 19:12:35 -0400, Roy Smith wrote: > >>> Good lord. I'd rather read C++ than UML. And I can't read C++. >> >> UML is under-rated. I certainly don't have any love of the 47 different >> flavors of diagram, but the basic idea of having a common graphical >> language for describing how objects and classes interact is pretty >> useful. Just don't ask me to remember which kind of arrowhead I'm >> supposed to use in which situation. > > > I frequently draw diagrams to understand the relationships between my > classes and the problem I am trying to solve. I almost invariably use one > type of box and one type of arrowhead. Sometimes if I'm bored I draw > doodles on the diagram. If only I could remember to be consistent about > what doodle I draw where, I too could be an UML guru. > Yea, it can be tricky. But if you persevere you will gain enlightenment. It does take a bit of application though. lipska -- Lipska the Kat: Troll hunter, sandbox destroyer and farscape dreamer of Aeryn Sun
[toc] | [prev] | [next] | [standalone]
| From | DJC <djc@news.invalid> |
|---|---|
| Date | 2012-08-06 11:20 +0200 |
| Subject | Re: Looking for a good introduction to object oriented programming with Python |
| Message-ID | <jvo29k$74l$1@dont-email.me> |
| In reply to | #26588 |
On 06/08/12 02:27, Steven D'Aprano wrote: > On Sun, 05 Aug 2012 19:12:35 -0400, Roy Smith wrote: > >>> Good lord. I'd rather read C++ than UML. And I can't read C++. >> >> UML is under-rated. I certainly don't have any love of the 47 different >> flavors of diagram, but the basic idea of having a common graphical >> language for describing how objects and classes interact is pretty >> useful. Just don't ask me to remember which kind of arrowhead I'm >> supposed to use in which situation. > > > I frequently draw diagrams to understand the relationships between my > classes and the problem I am trying to solve. I almost invariably use one > type of box and one type of arrowhead. Sometimes if I'm bored I draw > doodles on the diagram. If only I could remember to be consistent about > what doodle I draw where, I too could be an UML guru. > > Flow Charts redux
[toc] | [prev] | [next] | [standalone]
Page 1 of 4 [1] 2 3 4 Next page →
Back to top | Article view | comp.lang.python
csiph-web