Re: Classic OOP in Python

2015-11-12 Thread jongiddy
On Thursday, 18 June 2015 12:21:29 UTC+1, Jason P. wrote: > > I'm aware of duck typing. The point in using interfaces is to be explicit > about the boundaries of a system. > > Quite a red "Growing Object-Oriented Software, Guided by Tests", by the way. > In fact interfaces are key components i

Re: Classic OOP in Python

2015-06-21 Thread Laura Creighton
Ah, turns out there was an entry. I updated it. Laura -- https://mail.python.org/mailman/listinfo/python-list

Re: Classic OOP in Python

2015-06-20 Thread Mark Lawrence
On 19/06/2015 00:01, Laura Creighton wrote: In a message of Thu, 18 Jun 2015 11:50:28 +0100, Mark Lawrence writes: Throw in http://clonedigger.sourceforge.net/ as well and you've a really awesome combination. Mark Lawrence I didn't know about that one. Hey thank you, Mark. Looks great. It

Re: Classic OOP in Python

2015-06-18 Thread Laura Creighton
In a message of Thu, 18 Jun 2015 11:50:28 +0100, Mark Lawrence writes: >Throw in http://clonedigger.sourceforge.net/ as well and you've a really >awesome combination. > >Mark Lawrence > I didn't know about that one. Hey thank you, Mark. Looks great. It needs its own entry in https://wiki.python

Re: Classic OOP in Python

2015-06-18 Thread Cousin Stanley
> > python -m doctest application.py > > And from there, I would build up extra doc tests > An extra doc test that fails #!/usr/bin/env python """ NewsGroup comp.lang.python Subject .. Classic OOP in Python Date ..

Re: Classic OOP in Python

2015-06-18 Thread Ned Batchelder
On Thursday, June 18, 2015 at 7:21:29 AM UTC-4, Jason P. wrote: > El miércoles, 17 de junio de 2015, 21:44:51 (UTC+2), Ned Batchelder escribió: > > On Wednesday, June 17, 2015 at 3:21:32 PM UTC-4, Jason P. wrote: > > > Hello Python community. > > > > > > I come from a classic background in what r

Re: Classic OOP in Python

2015-06-18 Thread Chris Angelico
On Thu, Jun 18, 2015 at 9:03 PM, Fabien wrote: > Would you consider the following kind of program "unpythonic"? > > class MovingObject(object): > """Great doc about what a moving object is""" > > def move(self): > """Great doc about move""" > raise NotImplementedError() > >

Re: Classic OOP in Python

2015-06-18 Thread Marko Rauhamaa
Todd : > On Thu, Jun 18, 2015 at 1:03 PM, Fabien wrote: >> Would you consider the following kind of program "unpythonic"? >> >> class MovingObject(object): >> """Great doc about what a moving object is""" >> >> def move(self): >> """Great doc about move""" >> raise NotImpl

Re: Classic OOP in Python

2015-06-18 Thread Jason P.
El miércoles, 17 de junio de 2015, 22:39:31 (UTC+2), Marko Rauhamaa escribió: > Ned Batchelder : > > > TDD is about writing tests as a way to design the best system, and > > putting testing at the center of your development workflow. It works > > great with Python even without interfaces. > > I

Re: Classic OOP in Python

2015-06-18 Thread Jason P.
El miércoles, 17 de junio de 2015, 21:44:51 (UTC+2), Ned Batchelder escribió: > On Wednesday, June 17, 2015 at 3:21:32 PM UTC-4, Jason P. wrote: > > Hello Python community. > > > > I come from a classic background in what refers to OOP. Mostly Java and PHP > > (> 5.3). I'm used to abstract class

Re: Classic OOP in Python

2015-06-18 Thread Jason P.
El miércoles, 17 de junio de 2015, 21:44:51 (UTC+2), Ned Batchelder escribió: > On Wednesday, June 17, 2015 at 3:21:32 PM UTC-4, Jason P. wrote: > > Hello Python community. > > > > I come from a classic background in what refers to OOP. Mostly Java and PHP > > (> 5.3). I'm used to abstract class

Re: Classic OOP in Python

2015-06-18 Thread Todd
On Thu, Jun 18, 2015 at 1:03 PM, Fabien wrote: > On 06/17/2015 11:16 PM, sohcahto...@gmail.com wrote: > >> You don't need interfaces with Python. Duck typing makes that all >> possible. >> > > Yes, but I also like interfaces (or in python: mimicked interfaces with > NotImplementedError) for thei

Re: Classic OOP in Python

2015-06-18 Thread Fabien
On 06/17/2015 11:16 PM, sohcahto...@gmail.com wrote: You don't need interfaces with Python. Duck typing makes that all possible. Yes, but I also like interfaces (or in python: mimicked interfaces with NotImplementedError) for their clarity and documentation purposes. Would you consider the

Re: Classic OOP in Python

2015-06-18 Thread Mark Lawrence
On 17/06/2015 23:33, Laura Creighton wrote: In a message of Wed, 17 Jun 2015 14:14:34 -0700, Ned Batchelder writes: TDD is supposed to make you brave, not cowards, and it's Ned's most excellent tool http://nedbatchelder.com/code/coverage/ that I recommend to TDD dogmatic cowards. Even if you d

Re: Classic OOP in Python

2015-06-18 Thread Marco Buttu
On 17/06/2015 23:33, sohcahto...@gmail.com wrote: I had a Java class where we had to learn TDD, and that's the way TDD was taught to us, and I hated it. We watched a video of this guy explaining TDD with a hat that was red on the front and green on the back. It involved writing a simple faili

Re: Classic OOP in Python

2015-06-17 Thread Chris Angelico
On Thu, Jun 18, 2015 at 6:39 AM, Marko Rauhamaa wrote: > Another interesting ism I have read about is the idea that the starting > point of any software project should be the user manual. The developers > should then go and build the product that fits the manual. I've seldom met a *user* manual t

Re: Classic OOP in Python

2015-06-17 Thread Terry Reedy
On 6/17/2015 4:39 PM, Marko Rauhamaa wrote: Ned Batchelder : TDD is about writing tests as a way to design the best system, and putting testing at the center of your development workflow. It works great with Python even without interfaces. I use what I might call 'smart TDD'. I think it a mi

Re: Classic OOP in Python

2015-06-17 Thread Steven D'Aprano
On Thu, 18 Jun 2015 06:39 am, Marko Rauhamaa wrote: > Ned Batchelder : > >> TDD is about writing tests as a way to design the best system, and >> putting testing at the center of your development workflow. It works >> great with Python even without interfaces. > > I wonder how great it really is

Re: Classic OOP in Python

2015-06-17 Thread Ned Batchelder
On Wednesday, June 17, 2015 at 6:34:23 PM UTC-4, Laura Creighton wrote: > TDD is supposed to make you brave, not cowards, and it's > Ned's most excellent tool > http://nedbatchelder.com/code/coverage/ > that I recommend to TDD dogmatic cowards. > > Even if you don't want to use TTD, you will enjoy

Re: Classic OOP in Python

2015-06-17 Thread Laura Creighton
In a message of Wed, 17 Jun 2015 14:14:34 -0700, Ned Batchelder writes: >The true TDD acolytes advocate a very idiosyncratic workflow, it's true. >I don't do this, but I also don't consider myself a TDD person. I value >tests a great deal, and put a lot of effort into them, but I don't write >triv

Re: Classic OOP in Python

2015-06-17 Thread Mark Lawrence
On 17/06/2015 23:09, Laura Creighton wrote: ps -- Marko, we have ample evidence that you are an extremely clever person. But the purpose of TTD is not to make clever code, but wise code. TTD in the hands of a fool will never produce that. But how else do you have to check that your design, whi

Re: Classic OOP in Python

2015-06-17 Thread Laura Creighton
In a message of Wed, 17 Jun 2015 14:33:43 -0700, sohcahto...@gmail.com writes: >I had a Java class where we had to learn TDD, and that's the way TDD >was taught to us, and I hated it. We watched a video of this guy >explaining TDD with a hat that was red on the front and green on the >back. It i

Re: Classic OOP in Python

2015-06-17 Thread Laura Creighton
In a message of Wed, 17 Jun 2015 23:39:17 +0300, Marko Rauhamaa writes: >Ned Batchelder : > >> TDD is about writing tests as a way to design the best system, and >> putting testing at the center of your development workflow. It works >> great with Python even without interfaces. > >I wonder how gre

Re: Classic OOP in Python

2015-06-17 Thread Mark Lawrence
On 17/06/2015 22:33, sohcahto...@gmail.com wrote: On Wednesday, June 17, 2015 at 1:39:31 PM UTC-7, Marko Rauhamaa wrote: Ned Batchelder : TDD is about writing tests as a way to design the best system, and putting testing at the center of your development workflow. It works great with Python ev

Re: Classic OOP in Python

2015-06-17 Thread sohcahtoa82
On Wednesday, June 17, 2015 at 1:39:31 PM UTC-7, Marko Rauhamaa wrote: > Ned Batchelder : > > > TDD is about writing tests as a way to design the best system, and > > putting testing at the center of your development workflow. It works > > great with Python even without interfaces. > > I wonder h

Re: Classic OOP in Python

2015-06-17 Thread sohcahtoa82
On Wednesday, June 17, 2015 at 12:21:32 PM UTC-7, Jason P. wrote: > Hello Python community. > > I come from a classic background in what refers to OOP. Mostly Java and PHP > (> 5.3). I'm used to abstract classes, interfaces, access modifiers and so on. > > Don't get me wrong. I know that despite

Re: Classic OOP in Python

2015-06-17 Thread Ned Batchelder
On Wednesday, June 17, 2015 at 4:39:31 PM UTC-4, Marko Rauhamaa wrote: > The way it was explained to me was that in TDD you actually don't write > code to any requirements or design: you simply do the least to pass the > tests. Thus, say you need to write a program that inputs a string and > output

Re: Classic OOP in Python

2015-06-17 Thread Mark Lawrence
On 17/06/2015 21:39, Marko Rauhamaa wrote: Ned Batchelder : TDD is about writing tests as a way to design the best system, and putting testing at the center of your development workflow. It works great with Python even without interfaces. I wonder how great it really is. Testing is important,

Re: Classic OOP in Python

2015-06-17 Thread Marko Rauhamaa
Ned Batchelder : > TDD is about writing tests as a way to design the best system, and > putting testing at the center of your development workflow. It works > great with Python even without interfaces. I wonder how great it really is. Testing is important, that's for sure, but to make it a dogmat

Re: Classic OOP in Python

2015-06-17 Thread Ned Batchelder
On Wednesday, June 17, 2015 at 3:21:32 PM UTC-4, Jason P. wrote: > Hello Python community. > > I come from a classic background in what refers to OOP. Mostly Java and PHP > (> 5.3). I'm used to abstract classes, interfaces, access modifiers and so on. > > Don't get me wrong. I know that despite

Re: Classic OOP in Python

2015-06-17 Thread Skip Montanaro
On Wed, Jun 17, 2015 at 2:21 PM, Jason P. wrote: > I'm gonna try to develop a modest application from ground up using > TDD. If it had been done in Java for instance, I would made > extensive use of interfaces to define the boundaries of my > system. How would I do something like that in Python?

Classic OOP in Python

2015-06-17 Thread Jason P.
Hello Python community. I come from a classic background in what refers to OOP. Mostly Java and PHP (> 5.3). I'm used to abstract classes, interfaces, access modifiers and so on. Don't get me wrong. I know that despite the differences Python is fully object oriented. My point is, do you know an

Re: OOP in Python book?

2007-07-30 Thread Steve Holden
James Stroud wrote: > Dick Moores wrote: >> At 01:27 PM 7/28/2007, Dennis Lee Bieber wrote: >> >>> On Fri, 27 Jul 2007 16:27:57 -0700, Dick Moores <[EMAIL PROTECTED]> >>> declaimed the following in comp.lang.python: >>> >>> Well, the publisher is Prentice Hall, "The world's leading educat

Re: OOP in Python book?

2007-07-30 Thread James Stroud
Dick Moores wrote: > At 01:27 PM 7/28/2007, Dennis Lee Bieber wrote: > >> On Fri, 27 Jul 2007 16:27:57 -0700, Dick Moores <[EMAIL PROTECTED]> >> declaimed the following in comp.lang.python: >> >> >> > Well, the publisher is Prentice Hall, "The world's leading >> > educational publisher". Textbooks

Re: OOP in Python book?

2007-07-28 Thread Dick Moores
At 01:27 PM 7/28/2007, Dennis Lee Bieber wrote: >On Fri, 27 Jul 2007 16:27:57 -0700, Dick Moores <[EMAIL PROTECTED]> >declaimed the following in comp.lang.python: > > > > Well, the publisher is Prentice Hall, "The world's leading > > educational publisher". Textbooks are typically expensive. > > >

Re: OOP in Python book?

2007-07-27 Thread Dick Moores
At 08:41 AM 7/27/2007, Bill wrote: >Does anyone out there have any information about this book. It's >listed on Amazon to be published in November of this year. A simple >Google search (1st page only) doesn't show anything useful, and I >can't find a reference on the web sites of the authors. Neith

OOP in Python book?

2007-07-27 Thread Bill
Does anyone out there have any information about this book. It's listed on Amazon to be published in November of this year. A simple Google search (1st page only) doesn't show anything useful, and I can't find a reference on the web sites of the authors. Neither of the authors appears to be heavily

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Gregor Horvath wrote: > Steven D'Aprano schrieb: > > >>I don't know of many other OO languages that didn't/don't have >>inheritance, > > > VB4 - VB6 > VB6 has a kind of inheritance via interface/delegation. The interface part is for subtyping, the delegation part (which has to be done manuall

Re: About classes and OOP in Python

2006-04-12 Thread Magnus Lycka
Michele Simionato wrote: > Roy Smith wrote: > >> That being said, you can indeed have private data in Python. Just prefix >> your variable names with two underscores (i.e. __foo), and they effectively >> become private. Yes, you can bypass this if you really want to, but then >> again, you can b

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Casey Hawthorne wrote: >>I think it's important not to wrongly confuse 'OOP' with ''data hiding' >>or any other aspect you may be familiar with from Java or C++. The >>primary concept behind OOP is not buzzwords such as abstraction, >>encapsulation, polymorphism, etc etc, but the fact that your pro

Re: About classes and OOP in Python

2006-04-12 Thread bruno at modulix
Ben C wrote: > On 2006-04-11, Michele Simionato <[EMAIL PROTECTED]> wrote: > >>Roy Smith wrote: >> >> >>>That being said, you can indeed have private data in Python. Just prefix >>>your variable names with two underscores (i.e. __foo), and they effectively >>>become private. Yes, you can bypass

Re: About classes and OOP in Python

2006-04-11 Thread Gregor Horvath
Steven D'Aprano schrieb: > I don't know of many other OO languages that didn't/don't have > inheritance, VB4 - VB6 -- Mit freundlichen Grüßen, Ing. Gregor Horvath, Industrieberatung & Softwareentwicklung http://www.gregor-horvath.com -- http://mail.python.org/mailman/listinfo/python-list

Re: About classes and OOP in Python

2006-04-11 Thread Ben Cartwright
Michele Simionato wrote: > Roy Smith wrote: > > > That being said, you can indeed have private data in Python. Just prefix > > your variable names with two underscores (i.e. __foo), and they effectively > > become private. Yes, you can bypass this if you really want to, but then > > again, you c

Re: About classes and OOP in Python

2006-04-11 Thread Steven D'Aprano
On Tue, 11 Apr 2006 18:20:13 +, Casey Hawthorne wrote: >>I think it's important not to wrongly confuse 'OOP' with ''data hiding' >>or any other aspect you may be familiar with from Java or C++. The >>primary concept behind OOP is not buzzwords such as abstraction, >>encapsulation, polymorphism

Re: About classes and OOP in Python

2006-04-11 Thread Ben C
On 2006-04-11, Michele Simionato <[EMAIL PROTECTED]> wrote: > Roy Smith wrote: > >> That being said, you can indeed have private data in Python. Just prefix >> your variable names with two underscores (i.e. __foo), and they effectively >> become private. Yes, you can bypass this if you really wan

Re: About classes and OOP in Python

2006-04-11 Thread Casey Hawthorne
>I think it's important not to wrongly confuse 'OOP' with ''data hiding' >or any other aspect you may be familiar with from Java or C++. The >primary concept behind OOP is not buzzwords such as abstraction, >encapsulation, polymorphism, etc etc, but the fact that your program >consists of objects m

Re: About classes and OOP in Python

2006-04-11 Thread bruno at modulix
Roy Smith wrote: (snip) > That being said, you can indeed have private data in Python. Just prefix > your variable names with two underscores (i.e. __foo), and they effectively > become private. The double-leading-underscore stuff has nothing to do with "privacy". It's meant to protect from

Re: About classes and OOP in Python

2006-04-11 Thread bruno at modulix
fyhuang wrote: > Hello all, > > I've been wondering a lot about why Python handles classes and OOP the > way it does. From what I understand, there is no concept of class > encapsulation in Python, i.e. no such thing as a private variable. Seems you're confusing encapsulation with data hiding. >

Re: About classes and OOP in Python

2006-04-11 Thread Michele Simionato
Roy Smith wrote: > That being said, you can indeed have private data in Python. Just prefix > your variable names with two underscores (i.e. __foo), and they effectively > become private. Yes, you can bypass this if you really want to, but then > again, you can bypass private in C++ too. Wrong,

Re: About classes and OOP in Python

2006-04-11 Thread Fredrik Lundh
Ben Sizer wrote: > I think it's important not to wrongly confuse 'OOP' with ''data hiding' > or any other aspect you may be familiar with from Java or C++. The > primary concept behind OOP is not buzzwords such as abstraction, > encapsulation, polymorphism, etc etc, but the fact that your program

Re: About classes and OOP in Python

2006-04-11 Thread Ben Sizer
fyhuang wrote: > It seems to me that it is difficult to use OOP to a wide extent in > Python code because these features of the language introduce many > inadvertant bugs. For example, if the programmer typos a variable name > in an assignment, the assignment will probably not do what the > program

Re: About classes and OOP in Python

2006-04-10 Thread Gregor Horvath
Hi, fyhuang schrieb: > I've been wondering a lot about why Python handles classes and OOP the > way it does. From what I understand, there is no concept of class > encapsulation in Python, i.e. no such thing as a private variable. Any the answer is here: http://tinyurl.com/obgho -- Mit freund

Re: About classes and OOP in Python

2006-04-10 Thread Sion Arrowsmith
fyhuang <[EMAIL PROTECTED]> wrote: > [ ... ] no such thing as a private variable. Any >part of the code is allowed access to any variable in any class, and >even non-existant variables can be accessed: they are simply created. You're confusing two issues: encapsulation and dynamic name binding. Yo

Re: About classes and OOP in Python

2006-04-10 Thread Felipe Almeida Lessa
Em Seg, 2006-04-10 às 07:19 -0700, fyhuang escreveu: > class PythonClass: >private foo = "bar" >private var = 42 >allow_readwrite( [ foo, var ] ) You are aware that foo and var would become class-variables, not instance-variables, right? But you can always do: class PythonClass(objec

Re: About classes and OOP in Python

2006-04-10 Thread Roy Smith
"fyhuang" <[EMAIL PROTECTED]> wrote: > I've been wondering a lot about why Python handles classes and OOP the > way it does. From what I understand, there is no concept of class > encapsulation in Python, i.e. no such thing as a private variable. Any > part of the code is allowed access to any vari

Re: About classes and OOP in Python

2006-04-10 Thread [EMAIL PROTECTED]
You can do this in Python as well. Check out the property built-in function. One can declare a property with a get, set, and delete method. Here's a small example of a read-only property. class Test(object): def getProperty(self): return 0; prop = property(fget = getProperty)

About classes and OOP in Python

2006-04-10 Thread fyhuang
Hello all, I've been wondering a lot about why Python handles classes and OOP the way it does. From what I understand, there is no concept of class encapsulation in Python, i.e. no such thing as a private variable. Any part of the code is allowed access to any variable in any class, and even non-e

Re: oop in python

2005-12-30 Thread jmdeschamps
(addendum) ... And even ... >>> eval("t").max() 12 >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: oop in python

2005-12-30 Thread jmdeschamps
Larry Bates wrote: > novice wrote: > > hello over there! > > I have the following question: > > Suppose I created a class: class Point: > > pass > > then instanciated an instance: new = Point() > > So now how to get the insta

Re: oop in python

2005-12-30 Thread Larry Bates
novice wrote: > hello over there! > I have the following question: > Suppose I created a class: class Point: > pass > then instanciated an instance: new = Point() > So now how to get the instance new as a string: like ' new '

Re: oop in python

2005-12-27 Thread Steven D'Aprano
On Tue, 27 Dec 2005 02:42:18 -0800, novice wrote: > > hello over there! > I have the following question: > Suppose I created a class: class Point: > pass > then instanciated an instance: new = Point() > So now how to get the

Re: oop in python

2005-12-27 Thread Uwe Hoffmann
novice schrieb: > class Point: >def _func_that_we_want_(self): > return ... return self.__class__.__name__ http://docs.python.org/ref/types.html#l2h-109 -- http://mail.python.org/mailman/listinfo/python-list

oop in python

2005-12-27 Thread novice
hello over there! I have the following question: Suppose I created a class: class Point: pass then instanciated an instance: new = Point() So now how to get the instance new as a string: like ' new ' ; Is there any built in