Python Forum
Manipulating __init__ method
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Manipulating __init__ method
#6
if you don't like the else part and don't mind to assign to self.right twice, why not simply
    def __init__(self,a,b=None):
        self.left = a
        self.right = b
        if b is None:
            self.right = a
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
Manipulating __init__ method - by schniefen - May-06-2019, 01:03 AM
RE: Manipulating __init__ method - by Larz60+ - May-06-2019, 02:08 AM
RE: Manipulating __init__ method - by buran - May-06-2019, 04:53 AM
RE: Manipulating __init__ method - by schniefen - May-06-2019, 11:06 AM
RE: Manipulating __init__ method - by Yoriz - May-06-2019, 11:17 AM
RE: Manipulating __init__ method - by buran - May-06-2019, 11:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Manipulating panda dataframes more python-like badtwistoffate 4 2,146 Jan-31-2023, 04:30 AM
Last Post: deanhystad
  Manipulating code to draw a tree Py_thon 8 3,364 Nov-21-2019, 05:00 PM
Last Post: sumana
  Manipulating List frenchyinspace 2 2,773 Oct-08-2019, 07:57 AM
Last Post: perfringo
  Extend my __init__ method by an extra parameter Tol duyduy 8 4,122 Jun-04-2019, 06:47 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

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