Actionscript equivalent of Python's class "set"
In Python, there is a class called "set". I realize that sim开发者_StackOverflow中文版ilar functionality could be implemented in AS by a Dictionary where only the keys matter.
But it seems that this should be a built-in type for ActionScript. Unfortunately, it's nearly impossible to search for. Before I go off and code up my own "set" class, does it already exist?
No, it does not. But you should be careful - relying too much on a user-defined data type (sic) could lead to problems (read: bloated code), eg, if you're accepting varying types as arguments. That said, creating a helper class to deal with Python-like sets is probably the best way to go, though the best way would be likely, as you said, to use objects (Dictionary).
精彩评论