Some Progress
This release marks more types and APIs making their way into the library, improves performance in a few areas, adds a new custom HashMap type (replacing internal dictionaries), and various other changes/improvements/bugfixes.
Performance
This release introduces __slots__
usage on basically all stored model types. This improves memory usage, and also provides a more strict interface to the models (not allowing you to shimmy data into the model). There was also some improvements to the way gateway events are parsed which should result in faster event parsing.
Hash Map
This release also adds something very exciting, a custom dictionary type (using UserDict) which provides a whole set of utilities for working with stored data. Its easiest to see this interface with some simple examples:
guilds_with_15_users = state.guilds.find(lambda g: len(g.members) == 15)
first_guild_with_features = state.guilds.find_one(lambda g: len(g.features))
users_named_jeff = state.users.select(username="jeff")
user_named_joe = state.users.select_one(username="joe")
The hash map also overrides the most common Python dict functions to behave in a Python 3 generator-fashion (e.g. values()
will always return a generator).
Webhooks
A basic implementation of webhooks was also introduced. The interface to this is still rather immature, so there will likely be some change and additional helper methods soon.