Re: Object-oriented philosophy

2018-09-11 Thread Abdur-Rahmaan Janhangeer
i know about the ban but since marko was getting it was wondering how thanks ! Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Mauritius Ranting Rick is banned from posting to python-list. (And maybe also > from other Python project lists, I'm not sure about that.) > You can read abou

Re: Object-oriented philosophy

2018-09-11 Thread Abdur-Rahmaan Janhangeer
i did not see rick's mail on my gmail Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Mauritius Rick Johnson : > > > Michael F. Stemper wrote: > >> Object-oriented philosophy > > [...] [...] [...] > > > > So, to make a long story sh

Re: Object-oriented philosophy

2018-09-11 Thread Michael F. Stemper
On 2018-09-11 01:59, Marko Rauhamaa wrote: > Rick Johnson : > >> Michael F. Stemper wrote: >>> Object-oriented philosophy >> [...] [...] [...] >> >> So, to make a long story short, you may want to do some >> googling... > > Long story short, Mic

Re: Object-oriented philosophy

2018-09-11 Thread Marko Rauhamaa
Rick Johnson : > Michael F. Stemper wrote: >> Object-oriented philosophy > [...] [...] [...] > > So, to make a long story short, you may want to do some > googling... Long story short, Michael, Rick is a masterful troll extraordinaire. Highly amusing when you're in t

Re: Object-oriented philosophy

2018-09-11 Thread Antoon Pardon
On 07-09-18 22:08, Michael F. Stemper wrote: > >> try >>id = xmlmodel.attrib['name'] >> except KeyError: >>id = "constant power" > Never mind! After I continued testing, I realized that the above > should have been written as: > > if 'name' in xmlmodel.attrib: > id = xmlmodel.attrib

Re: Object-oriented philosophy

2018-09-09 Thread Abdur-Rahmaan Janhangeer
just see who a company employ as a py eng, ask him. Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Mauritius > > Does anyone here know anyone who would refer to themselves as a "Python > engineer" with a straight face? I merely ask... > > -- Thomas > -- > https://mail.python.org/mai

Re: Object-oriented philosophy

2018-09-09 Thread Amirouche Boubekki
Le jeu. 6 sept. 2018 à 16:05, Michael F. Stemper a écrit : > > How does one judge when it's worthwhile to do this and when it's > not? What criteria would somebody seasoned in OO and python use > to say "good idea" vs "don't waste your time"? > I may qualify as experienced with Python, that being

Re: Object-oriented philosophy

2018-09-09 Thread Gene Heskett
On Sunday 09 September 2018 08:19:52 Gilmeh Serda wrote: > On Thu, 06 Sep 2018 18:07:55 +0200, Thomas Jollans wrote: > >> Also, get someone, preferrable a python engineer to review your > >> code. > > > > Does anyone here know anyone who would refer to themselves as a > > "Python engineer" with a

Re: Object-oriented philosophy

2018-09-08 Thread Michael F. Stemper
On 2018-09-06 16:04, Stefan Ram wrote: > "Michael F. Stemper" writes: >>> You have a operation »Resistance( V )«. >> Mathematically, that's an operation, I suppose. I tend to think of it >> as either a function or a method. > > I deliberately did not use neither "a function" nor > "a method"

Re: Object-oriented philosophy

2018-09-07 Thread Steven D'Aprano
On Fri, 07 Sep 2018 16:07:06 -0500, Michael F. Stemper wrote: >>> In another case where I had a "bare exception", I was using it to see >>> if something was defined and substitute a default value if it wasn't. >>> Have I cleaned this up properly? >>> >>>   try >>>     id = xmlmodel.attrib['name']

Re: Object-oriented philosophy

2018-09-07 Thread Michael F. Stemper
On 2018-09-07 15:39, MRAB wrote: > On 2018-09-07 20:51, Michael F. Stemper wrote: >> On 2018-09-06 16:00, MRAB wrote: >>> A word of advice: don't use a "bare" except, i.e. one that doesn't >>> specify what exception(s) it should catch. >> >> Given that I moved the first line ("P_0s = ...") out of

Re: Object-oriented philosophy

2018-09-07 Thread MRAB
On 2018-09-07 21:08, Michael F. Stemper wrote: On 2018-09-07 14:51, Michael F. Stemper wrote: On 2018-09-06 16:00, MRAB wrote: On 2018-09-06 21:24, Michael F. Stemper wrote: A word of advice: don't use a "bare" except, i.e. one that doesn't specify what exception(s) it should catch. In an

Re: Object-oriented philosophy

2018-09-07 Thread MRAB
On 2018-09-07 20:51, Michael F. Stemper wrote: On 2018-09-06 16:00, MRAB wrote: On 2018-09-06 21:24, Michael F. Stemper wrote: On 2018-09-06 09:35, Rhodri James wrote: Is it worth creating the superclass in Python?  It sounds like it's a bit marginal in your case.  I'm not that seasoned in o

Re: Object-oriented philosophy

2018-09-07 Thread Michael F. Stemper
On 2018-09-07 14:51, Michael F. Stemper wrote: > On 2018-09-06 16:00, MRAB wrote: >> On 2018-09-06 21:24, Michael F. Stemper wrote: >> A word of advice: don't use a "bare" except, i.e. one that doesn't >> specify what exception(s) it should catch. > In another case where I had a "bare exception",

Re: Object-oriented philosophy

2018-09-07 Thread Michael F. Stemper
On 2018-09-06 16:00, MRAB wrote: > On 2018-09-06 21:24, Michael F. Stemper wrote: >> On 2018-09-06 09:35, Rhodri James wrote: >>> Is it worth creating the superclass in Python?  It sounds like it's a >>> bit marginal in your case.  I'm not that seasoned in object-oriented >>> design either, but my

Re: Object-oriented philosophy

2018-09-06 Thread Steven D'Aprano
On Thu, 06 Sep 2018 22:00:26 +0100, MRAB wrote: > On 2018-09-06 21:24, Michael F. Stemper wrote: [...] >>try: >> P_0s = xmlmodel.findall( 'RatedPower' )[0].text >> self.P_0 = float( P_0s ) >>except: [...] > A word of advice: don't use a "bare" except, i.e. one that doesn't > sp

Re: Object-oriented philosophy

2018-09-06 Thread MRAB
On 2018-09-06 21:24, Michael F. Stemper wrote: On 2018-09-06 09:35, Rhodri James wrote: On 06/09/18 15:04, Michael F. Stemper wrote: Net net is that the only thing that ended up being common was the __init__ methods. Two of the classes have identical __init__ methods; the third has a superset o

Re: Object-oriented philosophy

2018-09-06 Thread Michael F. Stemper
On 2018-09-06 12:32, Stefan Ram wrote: > "Michael F. Stemper" writes: >> Is there really any benefit to this change? Yes, I've eliminated >> some (a few lines per class) duplicate code. On the other hand, >> I've added the parent class and the (probably small, but not >> non-existent) overhead of

Re: Object-oriented philosophy

2018-09-06 Thread Michael F. Stemper
On 2018-09-06 10:40, Abdur-Rahmaan Janhangeer wrote: > Also, get someone, preferrable a python engineer to review your code. Sounds like an advertisement to me. -- Michael F. Stemper Why doesn't anybody care about apathy? -- https://mail.python.org/mailman/listinfo/python-list

Re: Object-oriented philosophy

2018-09-06 Thread Michael F. Stemper
On 2018-09-06 09:35, Rhodri James wrote: > On 06/09/18 15:04, Michael F. Stemper wrote: >> Net net is that the only thing that ended up being common was the >> __init__ methods. Two of the classes have identical __init__ >> methods; the third has a superset of that method. The other methods >> all

Re: Object-oriented philosophy

2018-09-06 Thread Michael F. Stemper
On 2018-09-06 09:34, Marko Rauhamaa wrote: > "Michael F. Stemper" : > >> Since the three classes all had common methods (by design), I >> thought that maybe refactoring these three classes to inherit from >> a parent class would be beneficial. I went ahead and did so. >> (Outlines of before and af

Re: Object-oriented philosophy

2018-09-06 Thread Rob Gaddi
On 09/06/2018 09:07 AM, Thomas Jollans wrote: On 2018-09-06 17:40, Abdur-Rahmaan Janhangeer wrote: Also, get someone, preferrable a python engineer to review your code. Does anyone here know anyone who would refer to themselves as a "Python engineer" with a straight face? I merely ask... -- T

Re: Object-oriented philosophy

2018-09-06 Thread Thomas Jollans
On 2018-09-06 17:40, Abdur-Rahmaan Janhangeer wrote: > Also, get someone, preferrable a python engineer to review your code. Does anyone here know anyone who would refer to themselves as a "Python engineer" with a straight face? I merely ask... -- Thomas -- https://mail.python.org/mailman/listin

Re: Object-oriented philosophy

2018-09-06 Thread Abdur-Rahmaan Janhangeer
Also, get someone, preferrable a python engineer to review your code. yours, Abdur-Rahmaan Janhangeer https://github.com/Abdur-rahmaanJ Mauritius -- https://mail.python.org/mailman/listinfo/python-list

Re: Object-oriented philosophy

2018-09-06 Thread Rhodri James
On 06/09/18 15:04, Michael F. Stemper wrote: Net net is that the only thing that ended up being common was the __init__ methods. Two of the classes have identical __init__ methods; the third has a superset of that method. The other methods all have completely different implementations. This isn't

Re: Object-oriented philosophy

2018-09-06 Thread Marko Rauhamaa
"Michael F. Stemper" : > Since the three classes all had common methods (by design), I > thought that maybe refactoring these three classes to inherit from > a parent class would be beneficial. I went ahead and did so. > (Outlines of before and after are at the end of the post.) > > Net net is tha

Object-oriented philosophy

2018-09-06 Thread Michael F. Stemper
Over the summer, I've been working on a simulation. After months of design and redesign, I finally coded it up in two days over Labor Day weekend. Works great. The core of the simulation is a set of models of three different types of electrical loads (characterized based on how they respond to vol