Re: Using Vitalije's code patterns

2020-01-30 Thread Edward K. Ream
On Wed, Jan 29, 2020 at 11:10 PM Thomas Passin wrote: >> Methods can be used outside their class, say within another class, only be instantiating a "helper" instance of the method's class. That's a clumsy pattern. > This isn't quite as true as you might think. You can reuse them - in other

Re: Using Vitalije's code patterns

2020-01-29 Thread Thomas Passin
On Thursday, January 30, 2020 at 12:10:50 AM UTC-5, Thomas Passin wrote: > > > Class B: > func2(self, parms) = A.func1 > Oops, I meant to write Class B: func2 = A.func1 -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe

Re: Using Vitalije's code patterns

2020-01-29 Thread Thomas Passin
On Tuesday, January 7, 2020 at 7:58:41 AM UTC-5, Edward K. Ream wrote: > > While working on leoAst.py, I have come to understand more fully several > of Vitalije's suggested code patterns: > > *Prefer functions to classes/methods* > > Classes and methods are essential in python. They aren't

Re: Using Vitalije's code patterns

2020-01-09 Thread Edward K. Ream
Thu, Jan 9, 2020 at 6:58 AM Brian Theado wrote: > I'm guessing this is a response only to my 2nd sentence and not both sentences? Correct. But in this case the present code is better, imo. I'm not suggesting that we should prefer functions to classes generally. Without a class, you would have

Re: Using Vitalije's code patterns

2020-01-09 Thread Brian Theado
On Thu, Jan 9, 2020 at 5:28 AM Edward K. Ream wrote: > On Wed, Jan 8, 2020 at 10:49 PM Brian Theado > wrote: > > *>> Prefer functions to classes/methods* > > > The TokenOrderTraverser class looks to me like a good opportunity to > follow the above principle. AFAICT, the way it is written, that

Re: Using Vitalije's code patterns

2020-01-09 Thread Edward K. Ream
On Wed, Jan 8, 2020 at 10:49 PM Brian Theado wrote: *>> Prefer functions to classes/methods* > The TokenOrderTraverser class looks to me like a good opportunity to follow the above principle. AFAICT, the way it is written, that class is ONLY useful if it is subclassed. True. > For me,

Re: Using Vitalije's code patterns

2020-01-08 Thread Brian Theado
On Tue, Jan 7, 2020 at 7:58 AM Edward K. Ream wrote: > While working on leoAst.py, I have come to understand more fully several > of Vitalije's suggested code patterns: > > *Prefer functions to classes/methods* > The TokenOrderTraverser class looks to me like a good opportunity to follow the