I want to pass the value supplied to the class parameter to a function in the same class as it's default arguments, so that i could reuse the function to do another calculation with a different parameter value.
I'm working on creating an ip address calculator as a challenge for me to help learn python programming.
But Pycharm says "Unresolved reference 'self' "
Code:
class IPOctet:
def __init__(self, ip_address, subnet_mask):
self.ip_address = ip_address
self.subnet_mask = subnet_mask
def validate_subnetmask(self, input_subnetmask = self.subnet_mask):
# this function validates the input_subnetmask value to check if its a numeric value and
# returns the value when validated.
# ...and i want the [input_subnetmask value] to be [self.subnet_mask] as its default arugument
# or any value passed into it when called.