Set.hx 751 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package python.lib;
  2. import python.NativeIterator;
  3. import python.NativeIterable;
  4. @:pythonImport("builtins", "set")
  5. extern class Set <T>
  6. {
  7. @:overload(function (?array:Array<T>):Void {})
  8. public function new (?iterable:NativeIterable<T>):Void;
  9. public inline function length ():Int
  10. {
  11. return python.lib.Builtin.len(this);
  12. }
  13. public inline function has (v:T):Bool
  14. {
  15. return python.Syntax.isIn(v, this);
  16. }
  17. public inline function minus (other:Set<T>):Set<T>
  18. {
  19. return python.Syntax.binop(this, "-", other);
  20. }
  21. public inline function plus (other:Set<T>):Set<T>
  22. {
  23. return python.Syntax.binop(this, "+", other);
  24. }
  25. function __iter__ ():NativeIterator<T>;
  26. public inline function iterator ():NativeIterator<T>
  27. {
  28. return __iter__();
  29. }
  30. }