mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-04 17:06:21 +00:00
Change certain sequences to use a special proxy type instead of list
This is to speed up cases where someone is just querying the length of the underlying sequence. If anything else is done to the sequence then it is copied from the original iterator. This change should be mostly transparent.
This commit is contained in:
@ -864,6 +864,25 @@ The return type of the following methods has been changed to an :term:`asynchron
|
||||
The ``NoMoreItems`` exception was removed as calling :func:`anext` or :meth:`~object.__anext__` on an
|
||||
:term:`asynchronous iterator` will now raise :class:`StopAsyncIteration`.
|
||||
|
||||
Changing certain lists to be lazy sequences instead
|
||||
-----------------------------------------------------
|
||||
|
||||
In order to improve performance when calculating the length of certain lists, certain attributes were changed to return a sequence rather than a :class:`list`.
|
||||
|
||||
A sequence is similar to a :class:`list` except it is read-only. In order to get a list again you can call :class:`list` on the resulting sequence.
|
||||
|
||||
The following properties were changed to return a sequence instead of a list:
|
||||
|
||||
- :attr:`Client.guilds`
|
||||
- :attr:`Client.emojis`
|
||||
- :attr:`Client.private_channels`
|
||||
- :attr:`Guild.roles`
|
||||
- :attr:`Guild.channels`
|
||||
- :attr:`Guild.members`
|
||||
|
||||
This change should be transparent, unless you are modifying the sequence by doing things such as ``list.append``.
|
||||
|
||||
|
||||
Removal of ``Embed.Empty``
|
||||
---------------------------
|
||||
|
||||
|
Reference in New Issue
Block a user