-1

I have a class:

class indentity_resolve():

    def __init__(self,
                 pii_combined_location,
                 block_col,
                 cores,
                 comparison_file_location):


        self.pii_combined_location = pii_combined_location
        self.block_col = block_col
        self.cores = cores
        self.comparison_file_location = comparison_file_location

I want to setup a similar class that inherits from this but adds and extra input. I've read similar examples but haven't been able to get it to work. Here's my attempted:

class indentity_resolve_delta(indentity_resolve):

    def __init__(self, resolved_pii_location_block):

        super().__init__()
        self.resolved_pii_location_block = resolved_pii_location_block

I get the error TypeError: __init__() got an unexpected keyword argument 'pii_combined_location'. It's probably and easy fix but I just can't get it right.

Auren Ferguson
  • 479
  • 6
  • 17

1 Answers1

0

You need to explicitly take all the arguments you need in the subclass initialiser, and pass them through to the superclass, by using args and kwargs:

class indentity_resolve_delta(indentity_resolve):

    def __init__(self, resolved_pii_location_block, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.resolved_pii_location_block = resolved_pii_location_block

For more info about args and kwargs: *args **kwargs