Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Indentation error... lol
#7
(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
Reply


Messages In This Thread
Indentation error... lol - by ironfelix717 - Apr-01-2020, 05:13 PM
RE: Indentation error... lol - by j.crater - Apr-01-2020, 05:39 PM
RE: Indentation error... lol - by stullis - Apr-01-2020, 05:40 PM
RE: Indentation error... lol - by buran - Apr-01-2020, 06:30 PM
RE: Indentation error... lol - by ironfelix717 - Apr-02-2020, 05:45 AM
RE: Indentation error... lol - by buran - Apr-02-2020, 06:09 AM
RE: Indentation error... lol - by ironfelix717 - Apr-02-2020, 02:19 PM
RE: Indentation error... lol - by stullis - Apr-02-2020, 02:24 PM
RE: Indentation error... lol - by buran - Apr-02-2020, 02:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Indentation Error With If Else Statement JoeDainton123 3 1,900 Aug-02-2020, 08:29 PM
Last Post: deanhystad
  Getting error message for indentation Shafla 5 2,976 May-07-2019, 08:56 PM
Last Post: Yoriz
  Help please - indentation error bil007 1 2,125 Mar-24-2019, 11:41 AM
Last Post: Yoriz
  Very strange error of indentation samsonite 12 5,494 Mar-22-2019, 10:45 AM
Last Post: samsonite
  Indentation error in Python code ErnestTBass 5 3,698 Feb-28-2019, 04:26 PM
Last Post: samsonite
  Class - Error Message (Indentation) tkj80 3 4,579 Jan-20-2017, 07:48 AM
Last Post: wavic

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020