Re: [Tutor] creating classes while coding

2011-02-21 Thread Steven D'Aprano
Bill Allen wrote: That raises my next question. Under what sort of programming circumstances does it make sense? "It" being object oriented programming. OO is good for encapsulation and code-reuse. One good sign you should consider a class is if you start building up many global variables.

Re: [Tutor] creating classes while coding

2011-02-21 Thread Steven D'Aprano
Bill Allen wrote: I know that Python not only supports OOP, but is fundamentally OOP in its design. Just in using the language and standard library, that much becomes obvious. However, I do wonder a bit about the practice I have seen of some Python programmers to implement relatively short bi

Re: [Tutor] creating classes while coding

2011-02-21 Thread Japhy Bartlett
I think OOP makes it easy for new programmers to set up programs, and it can make for some pretty neat English looking code, but a more functional approach generally makes for much leaner, faster performing code. I find them most useful when you have several functions that might need to share some

Re: [Tutor] creating classes while coding

2011-02-20 Thread Bill Allen
On Sun, Feb 20, 2011 at 19:59, Alan Gauld wrote: > > "Bill Allen" wrote > > > However, I do wonder a bit about the practice I have seen of some >> Python programmers to implement relatively short bits of code, that would >> be >> quite simple using functions and procedural code, with classes. >

Re: [Tutor] creating classes while coding

2011-02-20 Thread Alan Gauld
"Bill Allen" wrote However, I do wonder a bit about the practice I have seen of some Python programmers to implement relatively short bits of code, that would be quite simple using functions and procedural code, with classes. OOP is often overkill, but if its the normal way of programming

Re: [Tutor] creating classes while coding

2011-02-20 Thread Bill Allen
That raises my next question. Under what sort of programming circumstances does it make sense? --Bill On Sun, Feb 20, 2011 at 19:01, R. Alan Monroe wrote: > > I'll freely admit that I do not come from an OOP programming > > background, so designing classes is not my first impulse when

Re: [Tutor] creating classes while coding

2011-02-20 Thread R. Alan Monroe
> I'll freely admit that I do not come from an OOP programming > background, so designing classes is not my first impulse when > writing code. Am I missing something? In my book, no, you're not missing something. I refer to it as "drinking the OO kool-aid". It's not compulsory. I just use it when

[Tutor] creating classes while coding

2011-02-20 Thread Bill Allen
I know that Python not only supports OOP, but is fundamentally OOP in its design. Just in using the language and standard library, that much becomes obvious. However, I do wonder a bit about the practice I have seen of some Python programmers to implement relatively short bits of code, that wou