PythonObject

@dynamicCallable
@dynamicMemberLookup
public struct PythonObject
extension PythonObject : CustomStringConvertible
extension PythonObject : CustomPlaygroundDisplayConvertible
extension PythonObject : CustomReflectable
extension PythonObject : PythonConvertible, ConvertibleFromPython
extension PythonObject : SignedNumeric
extension PythonObject : Strideable
extension PythonObject : Equatable, Comparable
extension PythonObject : Hashable
extension PythonObject : MutableCollection
extension PythonObject : Sequence
extension PythonObject : ExpressibleByBooleanLiteral, ExpressibleByIntegerLiteral,
ExpressibleByFloatLiteral, ExpressibleByStringLiteral
extension PythonObject : ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral

PythonObject מייצג אובייקט ב- Python ותומך בחיפוש חברים דינמי. כל גישת חבר כמו object.foo תבקש באופן דינמי את זמן הריצה של Python עבור חבר עם השם שצוין באובייקט זה.

PythonObject מועבר ומוחזר מכל קריאות הפונקציה Python והפניות לחברים. הוא תומך בחשבון Python סטנדרטיים ואופרטורים להשוואה.

באופן פנימי, PythonObject מיושם כמצביע שנספר הפניות ל- Python C API PyObject .

  • תיאור טקסטואלי של PythonObject זה, שהופק על ידי Python.str .

    הַצהָרָה

    public var description: String { get }
  • הַצהָרָה

    public var playgroundDescription: Any { get }
  • הַצהָרָה

    public var customMirror: Mirror { get }
  • יוצר מופע חדש מערך PythonConvertible .

    הַצהָרָה

    init<T>(_ object: T) where T : PythonConvertible
  • הַצהָרָה

    public init(_ object: PythonObject)
  • הַצהָרָה

    public var pythonObject: PythonObject { get }
  • מחזירה גרסה ניתנת להתקשרות של PythonObject זה. כאשר קוראים, התוצאה זורקת שגיאת Swift אם פונקציית Python הבסיסית זורקת חריג Python.

    הַצהָרָה

    var throwing: ThrowingPythonObject { get }
  • מחזירה מעטפת PythonObject המסוגלת לגשת לחברים.

    הַצהָרָה

    var checking: CheckingPythonObject { get }
  • הַצהָרָה

    subscript(dynamicMember memberName: String) -> PythonObject { get nonmutating set }
  • גש לאלמנט המתאים לערכי PythonConvertible שצוינו המייצגים מפתח.

    הערה

    זה שווה ערך object[key] ב-Python.

    הַצהָרָה

    subscript(key: PythonConvertible...) -> PythonObject { get nonmutating set }
  • ממיר ל-2-tuple.

    הַצהָרָה

    var tuple2: (PythonObject, PythonObject) { get }
  • ממיר ל-3-tuple.

    הַצהָרָה

    var tuple3: (PythonObject, PythonObject, PythonObject) { get }
  • ממיר ל-4-tuple.

    הַצהָרָה

    var tuple4: (PythonObject, PythonObject, PythonObject, PythonObject) { get }
  • קרא self עם הארגומנטים המיקוםיים שצוינו.

    תְנַאִי מוּקדָם

    self חייב להיות פייתון שניתן להתקשר אליו.

    הַצהָרָה

    @discardableResult
    func dynamicallyCall(
        withArguments args: [PythonConvertible] = []) -> PythonObject

    פרמטרים

    args

    ארגומנטים מיקוםיים עבור Python הניתן להתקשרות.

  • קרא self עם הארגומנטים שצוינו.

    תְנַאִי מוּקדָם

    self חייב להיות פייתון שניתן להתקשר אליו.

    הַצהָרָה

    @discardableResult
    func dynamicallyCall(
        withKeywordArguments args:
        KeyValuePairs<String, PythonConvertible> = [:]) -> PythonObject

    פרמטרים

    args

    ארגומנטים של מיקום או מילת מפתח עבור Python הניתן להתקשרות.

  • הַצהָרָה

    init(tupleOf elements: PythonConvertible...)
  • הַצהָרָה

    init<T : Collection>(tupleContentsOf elements: T)
        where T.Element == PythonConvertible
  • הַצהָרָה

    init<T : Collection>(tupleContentsOf elements: T)
        where T.Element : PythonConvertible
  • הַצהָרָה

    static func + (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func - (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func * (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func / (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func += (lhs: inout PythonObject, rhs: PythonObject)
  • הַצהָרָה

    static func -= (lhs: inout PythonObject, rhs: PythonObject)
  • הַצהָרָה

    static func *= (lhs: inout PythonObject, rhs: PythonObject)
  • הַצהָרָה

    static func /= (lhs: inout PythonObject, rhs: PythonObject)
  • הַצהָרָה

    static func & (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func | (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func ^ (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func &= (lhs: inout PythonObject, rhs: PythonObject)
  • הַצהָרָה

    static func |= (lhs: inout PythonObject, rhs: PythonObject)
  • הַצהָרָה

    static func ^= (lhs: inout PythonObject, rhs: PythonObject)
  • הַצהָרָה

    prefix static func ~ (operand: `Self`) -> PythonObject
  • הַצהָרָה

    public init<T>(exactly value: T) where T : BinaryInteger
  • הַצהָרָה

    public typealias Magnitude = PythonObject
  • הַצהָרָה

    public var magnitude: PythonObject { get }
  • הַצהָרָה

    public prefix static func - (operand: `Self`) -> PythonObject
  • הַצהָרָה

    public typealias Stride = PythonObject
  • הַצהָרָה

    public func distance(to other: PythonObject) -> Stride
  • הַצהָרָה

    public func advanced(by stride: Stride) -> PythonObject
  • הַצהָרָה

    public static func == (lhs: PythonObject, rhs: PythonObject) -> Bool
  • הַצהָרָה

    public static func != (lhs: PythonObject, rhs: PythonObject) -> Bool
  • הַצהָרָה

    public static func < (lhs: PythonObject, rhs: PythonObject) -> Bool
  • הַצהָרָה

    public static func <= (lhs: PythonObject, rhs: PythonObject) -> Bool
  • הַצהָרָה

    public static func > (lhs: PythonObject, rhs: PythonObject) -> Bool
  • הַצהָרָה

    public static func >= (lhs: PythonObject, rhs: PythonObject) -> Bool
  • הַצהָרָה

    static func == (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func != (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func < (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func <= (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func > (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    static func >= (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • הַצהָרָה

    public func hash(into hasher: inout Hasher)
  • הַצהָרָה

    public typealias Index = PythonObject
  • הַצהָרָה

    public typealias Element = PythonObject
  • הַצהָרָה

    public var startIndex: Index { get }
  • הַצהָרָה

    public var endIndex: Index { get }
  • הַצהָרָה

    public func index(after i: Index) -> Index
  • הַצהָרָה

    public subscript(index: PythonObject) -> PythonObject { get set }
  • הַצהָרָה

    public struct Iterator : IteratorProtocol
  • הַצהָרָה

    public func makeIterator() -> Iterator
  • הַצהָרָה

    public init(booleanLiteral value: Bool)
  • הַצהָרָה

    public init(integerLiteral value: Int)
  • הַצהָרָה

    public init(floatLiteral value: Double)
  • הַצהָרָה

    public init(stringLiteral value: String)
  • הַצהָרָה

    public init(arrayLiteral elements: PythonObject...)
  • הַצהָרָה

    public typealias Key = PythonObject
  • הַצהָרָה

    public typealias Value = PythonObject
  • הַצהָרָה

    public init(dictionaryLiteral elements: (PythonObject, PythonObject)...)