पायथनऑब्जेक्ट

@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 : MutableCollection
extension PythonObject : Hashable
प्लेसहोल्डर10
extension PythonObject : Sequence
extension PythonObject : ExpressibleByBooleanLiteral, ExpressibleByIntegerLiteral,
ExpressibleByFloatLiteral, ExpressibleByStringLiteral
प्लेसहोल्डर12
extension PythonObject : ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral

PythonObject Python में एक ऑब्जेक्ट का प्रतिनिधित्व करता है और गतिशील सदस्य लुकअप का समर्थन करता है। object.foo जैसा कोई भी सदस्य एक्सेस इस ऑब्जेक्ट में निर्दिष्ट नाम वाले सदस्य के लिए गतिशील रूप से पायथन रनटाइम का अनुरोध करेगा।

PythonObject को सभी 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 का कॉल करने योग्य संस्करण लौटाता है। कॉल करने पर, यदि अंतर्निहित पायथन फ़ंक्शन पायथन अपवाद फेंकता है, तो परिणाम एक स्विफ्ट त्रुटि फेंकता है।

    घोषणा

    var throwing: ThrowingPythonObject { get }
  • सदस्य पहुंच में सक्षम PythonObject रैपर लौटाता है।

    घोषणा

    var checking: CheckingPythonObject { get }
  • घोषणा

    subscript(dynamicMember memberName: String) -> PythonObject { get nonmutating set }
  • एक कुंजी का प्रतिनिधित्व करने वाले निर्दिष्ट PythonConvertible मानों के अनुरूप तत्व तक पहुंचें।

    टिप्पणी

    यह पायथन में object[key] के बराबर है।

    घोषणा

    subscript(key: PythonConvertible...) -> PythonObject { get nonmutating set }
  • 2-टुपल में परिवर्तित हो जाता है।

    घोषणा

    var tuple2: (PythonObject, PythonObject) { get }
  • 3-टुपल में परिवर्तित हो जाता है।

    घोषणा

    var tuple3: (PythonObject, PythonObject, PythonObject) { get }
  • 4-टुपल में परिवर्तित हो जाता है।

    घोषणा

    var tuple4: (PythonObject, PythonObject, PythonObject, PythonObject) { get }
  • निर्दिष्ट स्थितीय तर्कों के साथ self कॉल करें।

    शर्त लगाना

    self एक पायथन कॉल करने योग्य होना चाहिए।

    घोषणा

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

    पैरामीटर

    args

    पायथन कॉल करने योग्य के लिए स्थितीय तर्क।

  • निर्दिष्ट तर्कों के साथ self कॉल करें।

    शर्त लगाना

    self एक पायथन कॉल करने योग्य होना चाहिए।

    घोषणा

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

    पैरामीटर

    args

    पायथन कॉल करने योग्य के लिए स्थितीय या कीवर्ड तर्क।

  • घोषणा

    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)...)