Manim: VGroup and VDict should implement `del`

Created on 3 Sep 2020  路  5Comments  路  Source: ManimCommunity/manim

del vgroup[0] or del vdict['key'] should just call .remove() on the appropriate elements

enhancement

Most helpful comment

Also, the easiest way of doing this is to have VDict inherit from collections.abc.Mapping or collections.abc.MutableMapping

All 5 comments

Sorry if i'm missing something, but what if one wants to remove an element from a VDict and not from the Scene ? Are you talking of scene.remove ?

class VDict():
def __del__(self, key):
    self.remove(key)

Similar: Implementing in for a VDict to check if key is in vdict (and similarly for a VGroup). To make VDict as close as possible to python dict, it would be great to support the methods listed here. Maybe "VDict 2.0" after attrs is merged?

Agreed. But also, Container should implement in...

Also, the easiest way of doing this is to have VDict inherit from collections.abc.Mapping or collections.abc.MutableMapping

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ChristianCoenen picture ChristianCoenen  路  5Comments

ackxolotl picture ackxolotl  路  4Comments

PgBiel picture PgBiel  路  5Comments

huguesdevimeux picture huguesdevimeux  路  6Comments

huguesdevimeux picture huguesdevimeux  路  7Comments