Is adding new attributes to an existing published module class's instances considered a Bad Practice in general, and instead you should sub-class it?
Background
I'm using pydicom, and want to keep some additional info with the pydicom Datasets (eg file_name for the file it was opened from, scaled_pixel_array for a zoomed pixel array, etc).
My quick approach (rather than sub-classing) has been just adding some additional attributes to the Datasets returned by pydicom, eg:
dcm = pydicom.dcmread('/tmp/1.dcm')
dcm.file_name = '/tmp/1.dcm' # <- this is an attribute I'm adding
dcm.scaled_pixel_array = <make a zoomed version of the image>
While this works fine, it fails if I try and pickle/de-pickle the Datasets (bug in pydicom 1.3, in pydicom 1.2.2 the added attributes don't appear when de-pickled).
This problem I can work around, or wait until version 1.3.1, but it made me want to ask a general python style question (I'm fairly new to python)
Question
My question is more about general python best practices/style:
Is adding attributes to a public imported module's instance's, like I did above, considered Bad Practice, and instead I should sub-class the pydicom Dataset (or any class in general) to add the new attributes?