Passing argument from method using superWhat's the difference between a method and a function?What is the difference between Python's list methods append and extend?Understanding Python super() with __init__() methodsStatic methods in Python?How do I pass a variable by reference?“Least Astonishment” and the Mutable Default Argument'Must Override a Superclass Method' Errors after importing a project into EclipseDoes Python have a string 'contains' substring method?Passing Data between View Controllersusing subclass attribute in the main class in python

Movie with Zoltar in a trailer park named Paradise and a boy playing a video game then being recruited by aliens to fight in space

Could this problem be tackled using Mathematica?

Why were the first airplanes "backwards"?

Discworld quote about an "old couple" who having said everything to each other, can finally go about living their lives

Should 私の be omitted?

Reusable spacecraft: why still have fairings detach, instead of open/close?

What is quadratization?

pgfmath does not work

Can dual citizens open crypto exchange accounts where U.S. citizens are prohibited?

Different budgets within roommate group

Why wasn't EBCDIC designed with contiguous alphanumeric characters?

Fully submerged water bath for stove top baking?

Does the CPT theorem hold for all spacetime dimensions?

How did Lefschetz do mathematics without hands?

Is there a way to convert blue ice back into packed ice?

Does a return economy-class seat between London and San Francisco release 5.28 tonnes of CO2 equivalents?

Preferred word for "preferred", "target", "chosen" in end user support documentation

I just started should I accept a farewell lunch for a coworker I don't know?

If two black hole event horizons overlap (touch) can they ever separate again?

What European countries have secret voting within the Legislature?

Could human civilization live 150 years in a nuclear-powered aircraft carrier colony without resorting to mass killing/ cannibalism?

Having to constantly redo everything because I don't know how to do it?

How can I deal with extreme temperatures in a hotel room?

Word ending in "-ine" for rat-like



Passing argument from method using super


What's the difference between a method and a function?What is the difference between Python's list methods append and extend?Understanding Python super() with __init__() methodsStatic methods in Python?How do I pass a variable by reference?“Least Astonishment” and the Mutable Default Argument'Must Override a Superclass Method' Errors after importing a project into EclipseDoes Python have a string 'contains' substring method?Passing Data between View Controllersusing subclass attribute in the main class in python






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm trying to set an argument role='r' under a method called getphone. It's working ok under init using super but I can't figure out how to do it under another method



The role is to set the permission level for the api that is running



this code is working



PATH = 'home_drive_'
PLATFORM = 'Linux_'
ITEM = '_PC'

class Credential:
def __init__(self, *, path, platform, role='', **kwargs):
super().__init__(**kwargs)
self.role = role
self.username_file = path + platform + role


class AXL(Credential):
def __init__(self, *, item, **kwargs):
super().__init__(role='rw', **kwargs)
self.item = item

def getphone(self):
self.role = 'r'
return self.username_file + self.item

def writephone(self):
self.role = 'rw'
return self.username_file + self.item

def statusphone(self):
self.role = 'rwx'
return self.username_file + self.item

reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)

print(reg1.getphone())
print(reg1.writephone())
print(reg1.statusphone())


under the class AXL, I want to move the role='r' under the method getphone



I've tried this and it's working but i don't understand why i need to put the path and platform.



PATH = 'home_drive_'
PLATFORM = 'Linux_'
ITEM = '_PC'

class Credential:
def __init__(self, *, path, platform, role='', **kwargs):
super().__init__(**kwargs)
self.role = role
self.username_file = path + platform + role


class AXL(Credential):
def __init__(self, *, item, **kwargs):
super().__init__(**kwargs)
self.item = item

def getphone(self):
super().__init__(path=PATH, platform=PLATFORM, role='r')
return self.username_file + self.item

def writephone(self):
super().__init__(path=PATH, platform=PLATFORM, role='rw')
return self.username_file + self.item

def statusphone(self):
super().__init__(path=PATH, platform=PLATFORM, role='rwx')
return self.username_file + self.item


reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)
print(reg1.getphone())
print(reg1.writephone())
print(reg1.statusphone())


a sandbox can be found here










share|improve this question
























  • If i understand correctly, you can set self.role = 'r' inside AXL.final.

    – heemayl
    Mar 25 at 14:43











  • If I understand you correctly, you can't (at least not in any way that conforms to conventions and that will be easy to debug). role is required to initialize a Credential instance so it must be provided when initializing an AXL instance.

    – DeepSpace
    Mar 25 at 14:44












  • It's not clear what your ultimate goal is. Do you want to replace the attribute username_file (currently initialized in __init__) with a method that computes a value using a given role when called? (Which would convert role from an attribute of an instance to simply an argument to final.)

    – chepner
    Mar 25 at 15:02












  • for example, i would have AXL.getphone, AXL.writephone and AXL.statusphone. getphone's role is read-only (r) writephone's role is read/write (rw) statusphone's role is read/write/execute (rwx) Depending of the role, the credential would return the username/pwd to use thank you

    – Louis-Philippe Descamps
    Mar 25 at 15:22











  • @chepner, this is what I'm trying to do repl.it/@louis_philippedescamps/…

    – Louis-Philippe Descamps
    Mar 26 at 9:17


















0















I'm trying to set an argument role='r' under a method called getphone. It's working ok under init using super but I can't figure out how to do it under another method



The role is to set the permission level for the api that is running



this code is working



PATH = 'home_drive_'
PLATFORM = 'Linux_'
ITEM = '_PC'

class Credential:
def __init__(self, *, path, platform, role='', **kwargs):
super().__init__(**kwargs)
self.role = role
self.username_file = path + platform + role


class AXL(Credential):
def __init__(self, *, item, **kwargs):
super().__init__(role='rw', **kwargs)
self.item = item

def getphone(self):
self.role = 'r'
return self.username_file + self.item

def writephone(self):
self.role = 'rw'
return self.username_file + self.item

def statusphone(self):
self.role = 'rwx'
return self.username_file + self.item

reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)

print(reg1.getphone())
print(reg1.writephone())
print(reg1.statusphone())


under the class AXL, I want to move the role='r' under the method getphone



I've tried this and it's working but i don't understand why i need to put the path and platform.



PATH = 'home_drive_'
PLATFORM = 'Linux_'
ITEM = '_PC'

class Credential:
def __init__(self, *, path, platform, role='', **kwargs):
super().__init__(**kwargs)
self.role = role
self.username_file = path + platform + role


class AXL(Credential):
def __init__(self, *, item, **kwargs):
super().__init__(**kwargs)
self.item = item

def getphone(self):
super().__init__(path=PATH, platform=PLATFORM, role='r')
return self.username_file + self.item

def writephone(self):
super().__init__(path=PATH, platform=PLATFORM, role='rw')
return self.username_file + self.item

def statusphone(self):
super().__init__(path=PATH, platform=PLATFORM, role='rwx')
return self.username_file + self.item


reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)
print(reg1.getphone())
print(reg1.writephone())
print(reg1.statusphone())


a sandbox can be found here










share|improve this question
























  • If i understand correctly, you can set self.role = 'r' inside AXL.final.

    – heemayl
    Mar 25 at 14:43











  • If I understand you correctly, you can't (at least not in any way that conforms to conventions and that will be easy to debug). role is required to initialize a Credential instance so it must be provided when initializing an AXL instance.

    – DeepSpace
    Mar 25 at 14:44












  • It's not clear what your ultimate goal is. Do you want to replace the attribute username_file (currently initialized in __init__) with a method that computes a value using a given role when called? (Which would convert role from an attribute of an instance to simply an argument to final.)

    – chepner
    Mar 25 at 15:02












  • for example, i would have AXL.getphone, AXL.writephone and AXL.statusphone. getphone's role is read-only (r) writephone's role is read/write (rw) statusphone's role is read/write/execute (rwx) Depending of the role, the credential would return the username/pwd to use thank you

    – Louis-Philippe Descamps
    Mar 25 at 15:22











  • @chepner, this is what I'm trying to do repl.it/@louis_philippedescamps/…

    – Louis-Philippe Descamps
    Mar 26 at 9:17














0












0








0








I'm trying to set an argument role='r' under a method called getphone. It's working ok under init using super but I can't figure out how to do it under another method



The role is to set the permission level for the api that is running



this code is working



PATH = 'home_drive_'
PLATFORM = 'Linux_'
ITEM = '_PC'

class Credential:
def __init__(self, *, path, platform, role='', **kwargs):
super().__init__(**kwargs)
self.role = role
self.username_file = path + platform + role


class AXL(Credential):
def __init__(self, *, item, **kwargs):
super().__init__(role='rw', **kwargs)
self.item = item

def getphone(self):
self.role = 'r'
return self.username_file + self.item

def writephone(self):
self.role = 'rw'
return self.username_file + self.item

def statusphone(self):
self.role = 'rwx'
return self.username_file + self.item

reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)

print(reg1.getphone())
print(reg1.writephone())
print(reg1.statusphone())


under the class AXL, I want to move the role='r' under the method getphone



I've tried this and it's working but i don't understand why i need to put the path and platform.



PATH = 'home_drive_'
PLATFORM = 'Linux_'
ITEM = '_PC'

class Credential:
def __init__(self, *, path, platform, role='', **kwargs):
super().__init__(**kwargs)
self.role = role
self.username_file = path + platform + role


class AXL(Credential):
def __init__(self, *, item, **kwargs):
super().__init__(**kwargs)
self.item = item

def getphone(self):
super().__init__(path=PATH, platform=PLATFORM, role='r')
return self.username_file + self.item

def writephone(self):
super().__init__(path=PATH, platform=PLATFORM, role='rw')
return self.username_file + self.item

def statusphone(self):
super().__init__(path=PATH, platform=PLATFORM, role='rwx')
return self.username_file + self.item


reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)
print(reg1.getphone())
print(reg1.writephone())
print(reg1.statusphone())


a sandbox can be found here










share|improve this question
















I'm trying to set an argument role='r' under a method called getphone. It's working ok under init using super but I can't figure out how to do it under another method



The role is to set the permission level for the api that is running



this code is working



PATH = 'home_drive_'
PLATFORM = 'Linux_'
ITEM = '_PC'

class Credential:
def __init__(self, *, path, platform, role='', **kwargs):
super().__init__(**kwargs)
self.role = role
self.username_file = path + platform + role


class AXL(Credential):
def __init__(self, *, item, **kwargs):
super().__init__(role='rw', **kwargs)
self.item = item

def getphone(self):
self.role = 'r'
return self.username_file + self.item

def writephone(self):
self.role = 'rw'
return self.username_file + self.item

def statusphone(self):
self.role = 'rwx'
return self.username_file + self.item

reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)

print(reg1.getphone())
print(reg1.writephone())
print(reg1.statusphone())


under the class AXL, I want to move the role='r' under the method getphone



I've tried this and it's working but i don't understand why i need to put the path and platform.



PATH = 'home_drive_'
PLATFORM = 'Linux_'
ITEM = '_PC'

class Credential:
def __init__(self, *, path, platform, role='', **kwargs):
super().__init__(**kwargs)
self.role = role
self.username_file = path + platform + role


class AXL(Credential):
def __init__(self, *, item, **kwargs):
super().__init__(**kwargs)
self.item = item

def getphone(self):
super().__init__(path=PATH, platform=PLATFORM, role='r')
return self.username_file + self.item

def writephone(self):
super().__init__(path=PATH, platform=PLATFORM, role='rw')
return self.username_file + self.item

def statusphone(self):
super().__init__(path=PATH, platform=PLATFORM, role='rwx')
return self.username_file + self.item


reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)
print(reg1.getphone())
print(reg1.writephone())
print(reg1.statusphone())


a sandbox can be found here







python oop superclass






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 26 at 12:43







Louis-Philippe Descamps

















asked Mar 25 at 14:41









Louis-Philippe DescampsLouis-Philippe Descamps

357 bronze badges




357 bronze badges












  • If i understand correctly, you can set self.role = 'r' inside AXL.final.

    – heemayl
    Mar 25 at 14:43











  • If I understand you correctly, you can't (at least not in any way that conforms to conventions and that will be easy to debug). role is required to initialize a Credential instance so it must be provided when initializing an AXL instance.

    – DeepSpace
    Mar 25 at 14:44












  • It's not clear what your ultimate goal is. Do you want to replace the attribute username_file (currently initialized in __init__) with a method that computes a value using a given role when called? (Which would convert role from an attribute of an instance to simply an argument to final.)

    – chepner
    Mar 25 at 15:02












  • for example, i would have AXL.getphone, AXL.writephone and AXL.statusphone. getphone's role is read-only (r) writephone's role is read/write (rw) statusphone's role is read/write/execute (rwx) Depending of the role, the credential would return the username/pwd to use thank you

    – Louis-Philippe Descamps
    Mar 25 at 15:22











  • @chepner, this is what I'm trying to do repl.it/@louis_philippedescamps/…

    – Louis-Philippe Descamps
    Mar 26 at 9:17


















  • If i understand correctly, you can set self.role = 'r' inside AXL.final.

    – heemayl
    Mar 25 at 14:43











  • If I understand you correctly, you can't (at least not in any way that conforms to conventions and that will be easy to debug). role is required to initialize a Credential instance so it must be provided when initializing an AXL instance.

    – DeepSpace
    Mar 25 at 14:44












  • It's not clear what your ultimate goal is. Do you want to replace the attribute username_file (currently initialized in __init__) with a method that computes a value using a given role when called? (Which would convert role from an attribute of an instance to simply an argument to final.)

    – chepner
    Mar 25 at 15:02












  • for example, i would have AXL.getphone, AXL.writephone and AXL.statusphone. getphone's role is read-only (r) writephone's role is read/write (rw) statusphone's role is read/write/execute (rwx) Depending of the role, the credential would return the username/pwd to use thank you

    – Louis-Philippe Descamps
    Mar 25 at 15:22











  • @chepner, this is what I'm trying to do repl.it/@louis_philippedescamps/…

    – Louis-Philippe Descamps
    Mar 26 at 9:17

















If i understand correctly, you can set self.role = 'r' inside AXL.final.

– heemayl
Mar 25 at 14:43





If i understand correctly, you can set self.role = 'r' inside AXL.final.

– heemayl
Mar 25 at 14:43













If I understand you correctly, you can't (at least not in any way that conforms to conventions and that will be easy to debug). role is required to initialize a Credential instance so it must be provided when initializing an AXL instance.

– DeepSpace
Mar 25 at 14:44






If I understand you correctly, you can't (at least not in any way that conforms to conventions and that will be easy to debug). role is required to initialize a Credential instance so it must be provided when initializing an AXL instance.

– DeepSpace
Mar 25 at 14:44














It's not clear what your ultimate goal is. Do you want to replace the attribute username_file (currently initialized in __init__) with a method that computes a value using a given role when called? (Which would convert role from an attribute of an instance to simply an argument to final.)

– chepner
Mar 25 at 15:02






It's not clear what your ultimate goal is. Do you want to replace the attribute username_file (currently initialized in __init__) with a method that computes a value using a given role when called? (Which would convert role from an attribute of an instance to simply an argument to final.)

– chepner
Mar 25 at 15:02














for example, i would have AXL.getphone, AXL.writephone and AXL.statusphone. getphone's role is read-only (r) writephone's role is read/write (rw) statusphone's role is read/write/execute (rwx) Depending of the role, the credential would return the username/pwd to use thank you

– Louis-Philippe Descamps
Mar 25 at 15:22





for example, i would have AXL.getphone, AXL.writephone and AXL.statusphone. getphone's role is read-only (r) writephone's role is read/write (rw) statusphone's role is read/write/execute (rwx) Depending of the role, the credential would return the username/pwd to use thank you

– Louis-Philippe Descamps
Mar 25 at 15:22













@chepner, this is what I'm trying to do repl.it/@louis_philippedescamps/…

– Louis-Philippe Descamps
Mar 26 at 9:17






@chepner, this is what I'm trying to do repl.it/@louis_philippedescamps/…

– Louis-Philippe Descamps
Mar 26 at 9:17













2 Answers
2






active

oldest

votes


















1














There's no one role associated with an instance; rather, the role is associated with a method called by the instance. Try this.



PATH = 'home_drive_'
PLATFORM = 'Linux_'
ITEM = '_PC'

class Credential:
def __init__(self, *, path, platform, **kwargs):
super().__init__(**kwargs)
self.username_file = path + platform


class AXL(Credential):
def __init__(self, *, item, **kwargs):
super().__init__(**kwargs)
self.item = item

# "Private" method used to implement the other phone methods
# You could inline this if you want.
def _phone(self, role):
return self.username_file + role + self.item

def getphone(self):
return self._phone('r')

def writephone(self):
return self._phone('rw')

def statusphone(self):
return self._phone('rwx')

reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)

print(reg1.getphone())
print(reg1.writephone())
print(reg1.statusphone())





share|improve this answer























  • that's working but not sure how I can use it in my real script that I copied here

    – Louis-Philippe Descamps
    Mar 26 at 15:10











  • It looks like anything involving role should be a method that builds the path on the fly using a role arugment, rather than being an attribute of an instance. Or, you should have a lot more subclasses, each of which does have a fixed role.

    – chepner
    Mar 26 at 15:15











  • Hi, what about doing it like this. thanks

    – Louis-Philippe Descamps
    Mar 27 at 14:00


















0














super() will let you access the parent class scope. You can access any method from it in the form super().method(args) in python3, with python 2 the format is super(YourClass,self).method(args).



Calling __init__ on the parent for each method doesn't seems to be right from the OOP perspective. You are reinitializing the parent object during its life time. If you want to set role from the parent you can simply use self.role = .... Any method on parent accessing self.role will see the modification.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55340337%2fpassing-argument-from-method-using-super%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    There's no one role associated with an instance; rather, the role is associated with a method called by the instance. Try this.



    PATH = 'home_drive_'
    PLATFORM = 'Linux_'
    ITEM = '_PC'

    class Credential:
    def __init__(self, *, path, platform, **kwargs):
    super().__init__(**kwargs)
    self.username_file = path + platform


    class AXL(Credential):
    def __init__(self, *, item, **kwargs):
    super().__init__(**kwargs)
    self.item = item

    # "Private" method used to implement the other phone methods
    # You could inline this if you want.
    def _phone(self, role):
    return self.username_file + role + self.item

    def getphone(self):
    return self._phone('r')

    def writephone(self):
    return self._phone('rw')

    def statusphone(self):
    return self._phone('rwx')

    reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)

    print(reg1.getphone())
    print(reg1.writephone())
    print(reg1.statusphone())





    share|improve this answer























    • that's working but not sure how I can use it in my real script that I copied here

      – Louis-Philippe Descamps
      Mar 26 at 15:10











    • It looks like anything involving role should be a method that builds the path on the fly using a role arugment, rather than being an attribute of an instance. Or, you should have a lot more subclasses, each of which does have a fixed role.

      – chepner
      Mar 26 at 15:15











    • Hi, what about doing it like this. thanks

      – Louis-Philippe Descamps
      Mar 27 at 14:00















    1














    There's no one role associated with an instance; rather, the role is associated with a method called by the instance. Try this.



    PATH = 'home_drive_'
    PLATFORM = 'Linux_'
    ITEM = '_PC'

    class Credential:
    def __init__(self, *, path, platform, **kwargs):
    super().__init__(**kwargs)
    self.username_file = path + platform


    class AXL(Credential):
    def __init__(self, *, item, **kwargs):
    super().__init__(**kwargs)
    self.item = item

    # "Private" method used to implement the other phone methods
    # You could inline this if you want.
    def _phone(self, role):
    return self.username_file + role + self.item

    def getphone(self):
    return self._phone('r')

    def writephone(self):
    return self._phone('rw')

    def statusphone(self):
    return self._phone('rwx')

    reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)

    print(reg1.getphone())
    print(reg1.writephone())
    print(reg1.statusphone())





    share|improve this answer























    • that's working but not sure how I can use it in my real script that I copied here

      – Louis-Philippe Descamps
      Mar 26 at 15:10











    • It looks like anything involving role should be a method that builds the path on the fly using a role arugment, rather than being an attribute of an instance. Or, you should have a lot more subclasses, each of which does have a fixed role.

      – chepner
      Mar 26 at 15:15











    • Hi, what about doing it like this. thanks

      – Louis-Philippe Descamps
      Mar 27 at 14:00













    1












    1








    1







    There's no one role associated with an instance; rather, the role is associated with a method called by the instance. Try this.



    PATH = 'home_drive_'
    PLATFORM = 'Linux_'
    ITEM = '_PC'

    class Credential:
    def __init__(self, *, path, platform, **kwargs):
    super().__init__(**kwargs)
    self.username_file = path + platform


    class AXL(Credential):
    def __init__(self, *, item, **kwargs):
    super().__init__(**kwargs)
    self.item = item

    # "Private" method used to implement the other phone methods
    # You could inline this if you want.
    def _phone(self, role):
    return self.username_file + role + self.item

    def getphone(self):
    return self._phone('r')

    def writephone(self):
    return self._phone('rw')

    def statusphone(self):
    return self._phone('rwx')

    reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)

    print(reg1.getphone())
    print(reg1.writephone())
    print(reg1.statusphone())





    share|improve this answer













    There's no one role associated with an instance; rather, the role is associated with a method called by the instance. Try this.



    PATH = 'home_drive_'
    PLATFORM = 'Linux_'
    ITEM = '_PC'

    class Credential:
    def __init__(self, *, path, platform, **kwargs):
    super().__init__(**kwargs)
    self.username_file = path + platform


    class AXL(Credential):
    def __init__(self, *, item, **kwargs):
    super().__init__(**kwargs)
    self.item = item

    # "Private" method used to implement the other phone methods
    # You could inline this if you want.
    def _phone(self, role):
    return self.username_file + role + self.item

    def getphone(self):
    return self._phone('r')

    def writephone(self):
    return self._phone('rw')

    def statusphone(self):
    return self._phone('rwx')

    reg1 = AXL(path=PATH, platform=PLATFORM, item=ITEM)

    print(reg1.getphone())
    print(reg1.writephone())
    print(reg1.statusphone())






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Mar 26 at 12:47









    chepnerchepner

    275k40 gold badges267 silver badges363 bronze badges




    275k40 gold badges267 silver badges363 bronze badges












    • that's working but not sure how I can use it in my real script that I copied here

      – Louis-Philippe Descamps
      Mar 26 at 15:10











    • It looks like anything involving role should be a method that builds the path on the fly using a role arugment, rather than being an attribute of an instance. Or, you should have a lot more subclasses, each of which does have a fixed role.

      – chepner
      Mar 26 at 15:15











    • Hi, what about doing it like this. thanks

      – Louis-Philippe Descamps
      Mar 27 at 14:00

















    • that's working but not sure how I can use it in my real script that I copied here

      – Louis-Philippe Descamps
      Mar 26 at 15:10











    • It looks like anything involving role should be a method that builds the path on the fly using a role arugment, rather than being an attribute of an instance. Or, you should have a lot more subclasses, each of which does have a fixed role.

      – chepner
      Mar 26 at 15:15











    • Hi, what about doing it like this. thanks

      – Louis-Philippe Descamps
      Mar 27 at 14:00
















    that's working but not sure how I can use it in my real script that I copied here

    – Louis-Philippe Descamps
    Mar 26 at 15:10





    that's working but not sure how I can use it in my real script that I copied here

    – Louis-Philippe Descamps
    Mar 26 at 15:10













    It looks like anything involving role should be a method that builds the path on the fly using a role arugment, rather than being an attribute of an instance. Or, you should have a lot more subclasses, each of which does have a fixed role.

    – chepner
    Mar 26 at 15:15





    It looks like anything involving role should be a method that builds the path on the fly using a role arugment, rather than being an attribute of an instance. Or, you should have a lot more subclasses, each of which does have a fixed role.

    – chepner
    Mar 26 at 15:15













    Hi, what about doing it like this. thanks

    – Louis-Philippe Descamps
    Mar 27 at 14:00





    Hi, what about doing it like this. thanks

    – Louis-Philippe Descamps
    Mar 27 at 14:00













    0














    super() will let you access the parent class scope. You can access any method from it in the form super().method(args) in python3, with python 2 the format is super(YourClass,self).method(args).



    Calling __init__ on the parent for each method doesn't seems to be right from the OOP perspective. You are reinitializing the parent object during its life time. If you want to set role from the parent you can simply use self.role = .... Any method on parent accessing self.role will see the modification.






    share|improve this answer



























      0














      super() will let you access the parent class scope. You can access any method from it in the form super().method(args) in python3, with python 2 the format is super(YourClass,self).method(args).



      Calling __init__ on the parent for each method doesn't seems to be right from the OOP perspective. You are reinitializing the parent object during its life time. If you want to set role from the parent you can simply use self.role = .... Any method on parent accessing self.role will see the modification.






      share|improve this answer

























        0












        0








        0







        super() will let you access the parent class scope. You can access any method from it in the form super().method(args) in python3, with python 2 the format is super(YourClass,self).method(args).



        Calling __init__ on the parent for each method doesn't seems to be right from the OOP perspective. You are reinitializing the parent object during its life time. If you want to set role from the parent you can simply use self.role = .... Any method on parent accessing self.role will see the modification.






        share|improve this answer













        super() will let you access the parent class scope. You can access any method from it in the form super().method(args) in python3, with python 2 the format is super(YourClass,self).method(args).



        Calling __init__ on the parent for each method doesn't seems to be right from the OOP perspective. You are reinitializing the parent object during its life time. If you want to set role from the parent you can simply use self.role = .... Any method on parent accessing self.role will see the modification.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 26 at 13:03









        geckosgeckos

        1,5481 gold badge13 silver badges26 bronze badges




        1,5481 gold badge13 silver badges26 bronze badges



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55340337%2fpassing-argument-from-method-using-super%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해