2
0

Set.hx 797 B

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