Apr-02-2020, 02:19 PM
(Apr-02-2020, 06:09 AM)buran Wrote:(Apr-02-2020, 05:45 AM)ironfelix717 Wrote: Unless it is illegal to nest classes in Python i'm not sure how its so obvious.
lines 36-24:
def __init__(self,tablename): def Wipe(self): def Copy(self): def AddField(self):and
lines 49-53:
def Count(self): def Add(name,type="text"): def Edit(self):all of these are at the same level of indentation. That is why it is so obvious...You have like 7 functions without body. After each of these lines it expects indented block of code.
And also even if not illegal you sholud not abuse nesting . A class nested 3 levels deep... All I have to say is Flat is better than nested.
Zen of python
They are at the same level of indentation for obvious reason: they are all methods of the same class object. I'm laying out the structure of my object. I'm not writing the methods yet. So, i can't have an empty function in python? That's an awesome feature.
Disagreed about flat vs nested. Perhaps that is the "pythonic" way, to me, life makes more sense when there's a hierarchy. That's evident not just in programming.
Cheers