পাইথন অবজেক্ট

@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 : ExpressibleByBooleanLiteral, ExpressibleByIntegerLiteral,
ExpressibleByFloatLiteral, ExpressibleByStringLiteral
extension PythonObject : Sequence
extension PythonObject : ExpressibleByArrayLiteral, ExpressibleByDictionaryLiteral

PythonObject পাইথনে একটি বস্তুর প্রতিনিধিত্ব করে এবং গতিশীল সদস্য লুকআপ সমর্থন করে। object.foo এর মতো যেকোন সদস্যের অ্যাক্সেস এই বস্তুর নির্দিষ্ট নামের সদস্যের জন্য পাইথন রানটাইম গতিশীলভাবে অনুরোধ করবে।

PythonObject সব Python ফাংশন কল এবং সদস্য রেফারেন্স থেকে পাস করা হয় এবং ফিরে আসে। এটি স্ট্যান্ডার্ড পাইথন পাটিগণিত এবং তুলনা অপারেটর সমর্থন করে।

অভ্যন্তরীণভাবে, PythonObject একটি Python C API PyObject এ একটি রেফারেন্স-গণনা করা পয়েন্টার হিসাবে প্রয়োগ করা হয়।

  • Python.str দ্বারা উত্পাদিত এই PythonObject এর একটি পাঠ্য বিবরণ।

    ঘোষণা

    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

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