dasbus icon indicating copy to clipboard operation
dasbus copied to clipboard

`to_structure` should be an instance method

Open AdamWill opened this issue 2 months ago • 0 comments

While working on https://github.com/rhinstaller/anaconda/pull/6691 I found it rather confusing that DBusData.to_interface is a class method. It explicitly only operates on values of data that are instances of the class, after all. So why isn't it an instance method? It seems like this:

import SomeDataSubclass
data = SomeDataSubclass()
interface = data.to_interface()

would be way simpler and easier to follow than this:

import SomeDataSubclass
data = SomeDataSubclass()
interface = SomeDataSubclass.to_interface(data)

in-line like that it's not too bad, but it's much worse when the bits are all spread out across multiple files.

AdamWill avatar Oct 09 '25 17:10 AdamWill