Regression: Reply-objects don't support indexing anymore
s-ol opened this issue · 4 comments
s-ol commented
This used to work:
print(i3ipc.Connection().get_workspaces()[0]['name'])
if I read this diff correctly, then both workspace.name
and workspace['name']
used to work.
Should the ability to index via subscription be reimplemented? A simple addition like
class _BaseReply
# ...
def __getitem__(self, k):
return getattr(self, k)
def __setitem__(self, k, v):
return setattr(self, k, v)
def __delitem__(self, k):
return delattr(self, k)
should suffice.
acrisci commented
Yeah this was a breaking change in 2.0. Why would you want both?
s-ol commented
For compatibility, it seems kind of unecessary to break this. This also isn't mentioned in the 2.0.1 release notes.
acrisci commented
You can put it back in like that if you want, but don't document it and mark it as deprecated.
s-ol commented
Okay... but if that means you will remove the feature again in a later update I will rather patch downstream.