PythonNesnesi

@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'da bir nesneyi temsil eder ve dinamik üye aramayı destekler. object.foo gibi herhangi bir üye erişimi, bu nesnede belirtilen ada sahip bir üye için dinamik olarak Python çalışma zamanını isteyecektir.

PythonObject tüm Python işlev çağrılarına ve üye referanslarına iletilir ve bunlardan döndürülür. Standart Python aritmetiğini ve karşılaştırma operatörlerini destekler.

Dahili olarak PythonObject , Python C API'si PyObject referans sayılan bir işaretçi olarak uygulanır.

  • Bu PythonObject Python.str tarafından üretilen metinsel açıklaması.

    beyan

    public var description: String { get }
  • beyan

    public var playgroundDescription: Any { get }
  • beyan

    public var customMirror: Mirror { get }
  • PythonConvertible değerinden yeni bir örnek oluşturur.

    beyan

    init<T>(_ object: T) where T : PythonConvertible
  • beyan

    public init(_ object: PythonObject)
  • beyan

    public var pythonObject: PythonObject { get }
  • Bu PythonObject öğesinin çağrılabilir bir sürümünü döndürür. Çağrıldığında, temel Python işlevi bir Python istisnası atarsa ​​sonuç bir Swift hatası atar.

    beyan

    var throwing: ThrowingPythonObject { get }
  • Üye erişimine sahip bir PythonObject sarmalayıcısı döndürür.

    beyan

    var checking: CheckingPythonObject { get }
  • beyan

    subscript(dynamicMember memberName: String) -> PythonObject { get nonmutating set }
  • Bir anahtarı temsil eden belirtilen PythonConvertible değerlerine karşılık gelen öğeye erişin.

    Not

    Bu, Python'daki object[key] ile eşdeğerdir.

    beyan

    subscript(key: PythonConvertible...) -> PythonObject { get nonmutating set }
  • 2'li tuple'a dönüşür.

    beyan

    var tuple2: (PythonObject, PythonObject) { get }
  • 3'lü tuple'a dönüşür.

    beyan

    var tuple3: (PythonObject, PythonObject, PythonObject) { get }
  • 4'lü tuple'a dönüşür.

    beyan

    var tuple4: (PythonObject, PythonObject, PythonObject, PythonObject) { get }
  • Belirtilen konumsal bağımsız değişkenlerle self çağırın.

    Önkoşul

    self bir Python çağrılabilir olmalıdır.

    beyan

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

    Parametreler

    args

    Python çağrılabilir için konumsal bağımsız değişkenler.

  • Belirtilen argümanlarla self çağır.

    Önkoşul

    self bir Python çağrılabilir olmalıdır.

    beyan

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

    Parametreler

    args

    Çağrılabilir Python için konumsal veya anahtar kelime bağımsız değişkenleri.

  • beyan

    init(tupleOf elements: PythonConvertible...)
  • beyan

    init<T : Collection>(tupleContentsOf elements: T)
        where T.Element == PythonConvertible
  • beyan

    init<T : Collection>(tupleContentsOf elements: T)
        where T.Element : PythonConvertible
  • beyan

    static func + (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func - (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func * (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func / (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func += (lhs: inout PythonObject, rhs: PythonObject)
  • beyan

    static func -= (lhs: inout PythonObject, rhs: PythonObject)
  • beyan

    static func *= (lhs: inout PythonObject, rhs: PythonObject)
  • beyan

    static func /= (lhs: inout PythonObject, rhs: PythonObject)
  • beyan

    static func & (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func | (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func ^ (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func &= (lhs: inout PythonObject, rhs: PythonObject)
  • beyan

    static func |= (lhs: inout PythonObject, rhs: PythonObject)
  • beyan

    static func ^= (lhs: inout PythonObject, rhs: PythonObject)
  • beyan

    prefix static func ~ (operand: `Self`) -> PythonObject
  • beyan

    public init<T>(exactly value: T) where T : BinaryInteger
  • beyan

    public typealias Magnitude = PythonObject
  • beyan

    public var magnitude: PythonObject { get }
  • beyan

    public prefix static func - (operand: `Self`) -> PythonObject
  • beyan

    public typealias Stride = PythonObject
  • beyan

    public func distance(to other: PythonObject) -> Stride
  • beyan

    public func advanced(by stride: Stride) -> PythonObject
  • beyan

    public static func == (lhs: PythonObject, rhs: PythonObject) -> Bool
  • beyan

    public static func != (lhs: PythonObject, rhs: PythonObject) -> Bool
  • beyan

    public static func < (lhs: PythonObject, rhs: PythonObject) -> Bool
  • beyan

    public static func <= (lhs: PythonObject, rhs: PythonObject) -> Bool
  • beyan

    public static func > (lhs: PythonObject, rhs: PythonObject) -> Bool
  • beyan

    public static func >= (lhs: PythonObject, rhs: PythonObject) -> Bool
  • beyan

    static func == (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func != (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func < (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func <= (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func > (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    static func >= (lhs: PythonObject, rhs: PythonObject) -> PythonObject
  • beyan

    public func hash(into hasher: inout Hasher)
  • beyan

    public typealias Index = PythonObject
  • beyan

    public typealias Element = PythonObject
  • beyan

    public var startIndex: Index { get }
  • beyan

    public var endIndex: Index { get }
  • beyan

    public func index(after i: Index) -> Index
  • beyan

    public subscript(index: PythonObject) -> PythonObject { get set }
  • beyan

    public struct Iterator : IteratorProtocol
  • beyan

    public func makeIterator() -> Iterator
  • beyan

    public init(booleanLiteral value: Bool)
  • beyan

    public init(integerLiteral value: Int)
  • beyan

    public init(floatLiteral value: Double)
  • beyan

    public init(stringLiteral value: String)
  • beyan

    public init(arrayLiteral elements: PythonObject...)
  • beyan

    public typealias Key = PythonObject
  • beyan

    public typealias Value = PythonObject
  • beyan

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