Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
colpage.py
#15
Quote:ok, so you are saying that no one codes a return statement on __init__(). what if complicated logic can be coded simpler by having a return in nested conditionals?
If your class __init__ has the need for nested loops such that you need to break out of multiple levels, I would say there is probably something deeper wrong.  Also if I had something that complex that needed to be done in __init__, like in your code, it would be relegated to its own function called from __init__.

In principle I don't have a problem with a mid function return to get out of nested loops (None or otherwise) but in practice there are often better ways.  As usual it comes down to what is most readable, and what is considered "most readable" is driven by convention.
Reply


Messages In This Thread
colpage.py - by Skaperen - Apr-29-2017, 06:12 AM
RE: colpage.py - by volcano63 - Apr-29-2017, 09:04 AM
RE: colpage.py - by nilamo - Apr-29-2017, 04:57 PM
RE: colpage.py - by Skaperen - Apr-30-2017, 02:41 AM
RE: colpage.py - by Skaperen - Apr-30-2017, 04:10 AM
RE: colpage.py - by nilamo - Apr-30-2017, 04:31 AM
RE: colpage.py - by Mekire - Apr-30-2017, 04:42 AM
RE: colpage.py - by Skaperen - Apr-30-2017, 05:24 AM
RE: colpage.py - by Skaperen - Apr-30-2017, 05:10 AM
RE: colpage.py - by Mekire - Apr-30-2017, 05:14 AM
RE: colpage.py - by Skaperen - Apr-30-2017, 05:36 AM
RE: colpage.py - by Mekire - Apr-30-2017, 05:28 AM
RE: colpage.py - by Skaperen - May-02-2017, 04:31 AM
RE: colpage.py - by Mekire - Apr-30-2017, 05:46 AM
RE: colpage.py - by Skaperen - Apr-30-2017, 06:15 AM
RE: colpage.py - by Mekire - Apr-30-2017, 07:17 AM
RE: colpage.py - by Skaperen - Apr-30-2017, 09:42 AM
RE: colpage.py - by volcano63 - May-01-2017, 05:00 PM
RE: colpage.py - by Mekire - May-01-2017, 10:39 PM
RE: colpage.py - by volcano63 - May-01-2017, 10:47 PM

Forum Jump:

User Panel Messages

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