Set.hx 818 B

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