Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
colpage.py
#14
from the reference documentation (emphasis mine):

Quote:Because __new__() and __init__() work together in constructing objects (__new__() to create it, and __init__() to customize it), no [u]non-None[/u] value may be returned by __init__(); doing so will cause a TypeError to be raised at runtime.
it does not say, one way or the other, whether an explicit None or implicit None is the way to code this.  indeed, a quick look at several classes i did not code show a predominance of implicit returns by having no return coded at all.  it has been my general practice (with some exceptions) to code explicitly in the various languages i code in.

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?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
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