Overloading __getitem__() for two key types in Python
From Python 3.3, the collections module added collections.ChainMap.
Utilizing this class can simplify your code.
You should probably make self.a_ids and self.b_ids a list. And index to get which one you want, such as self.ids[0]. This list is created when using ChainMap anyway too.


And so I'd change your code to something more like:

from collections import ChainMap


class UserList:
    def __init__(self, users):
        self._lookup = ChainMap({}, {})
        self.ids = self._lookup.maps
        for user in users:
            self.ids[0][user['a_id']] = user
            self.ids[1][user['b_id']] = user

    def __contains__(self, some_id):
        return some_id in self._lookup

    def __getitem__(self, some_id):
        return self._lookup[some_id]


Alternately, you could subclass ChainMap, and not need to write any of the methods.

from collections import ChainMap


class UserList(ChainMap):
    def __init__(self, users):
        super().__init__({}, {})
        for user in users:
            self.maps[0][user['a_id']] = user
            self.maps[1][user['b_id']] = user


However, at that point, there's not much benefit to using a class. And so I'd just use a raw ChainMap.