@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
reprezentuje obiekt w Pythonie i obsługuje dynamiczne wyszukiwanie członka. Każdy dostęp członek jak object.foo
dynamicznie żądać runtime Python dla członka o podanej nazwie w tym obiekcie.
PythonObject
jest przekazywany i wrócił ze wszystkich wywołań funkcji Python i odniesień członkowskich. Obsługuje standardowe operatory arytmetyczne i porównania Pythona.
Wewnętrznie PythonObject
jest wykonany jako odniesienia liczone wskaźnik do pytona API C PyObject
.
Tekstowy opis tego
PythonObject
, wyprodukowany przezPython.str
.Deklaracja
public var description: String { get }
Deklaracja
public var playgroundDescription: Any { get }
Deklaracja
public var customMirror: Mirror { get }
Tworzy nową instancję od A
PythonConvertible
wartości.Deklaracja
init<T>(_ object: T) where T : PythonConvertible
Deklaracja
public init(_ object: PythonObject)
Deklaracja
public var pythonObject: PythonObject { get }
Zwraca wpłacone wersję tego
PythonObject
. Po wywołaniu wynik zgłasza błąd Swift, jeśli podstawowa funkcja Pythona zgłasza wyjątek Pythona.Deklaracja
var throwing: ThrowingPythonObject { get }
Zwraca
PythonObject
wrapper stanie wejść członkowskich.Deklaracja
var checking: CheckingPythonObject { get }
Deklaracja
subscript(dynamicMember memberName: String) -> PythonObject { get nonmutating set }
Dostęp element odpowiadający określonej
PythonConvertible
wartości reprezentujące klucz.Notatka
Jest to równoznaczne zobject[key]
w Pythonie.Deklaracja
subscript(key: PythonConvertible...) -> PythonObject { get nonmutating set }
Konwertuje na krotkę 2.
Deklaracja
var tuple2: (PythonObject, PythonObject) { get }
Konwertuje na 3-krotkę.
Deklaracja
var tuple3: (PythonObject, PythonObject, PythonObject) { get }
Konwertuje na 4-krotkę.
Deklaracja
var tuple4: (PythonObject, PythonObject, PythonObject, PythonObject) { get }
Zadzwoń do
self
z podanych argumentów pozycyjnych.Warunek wstępny
self
musi być wymagalne Python.Deklaracja
@discardableResult func dynamicallyCall( withArguments args: [PythonConvertible] = []) -> PythonObject
Parametry
args
Argumenty pozycyjne dla wywoływalnej Pythona.
Zadzwoń do
self
z podanych argumentów.Warunek wstępny
self
musi być wymagalne Python.Deklaracja
@discardableResult func dynamicallyCall( withKeywordArguments args: KeyValuePairs<String, PythonConvertible> = [:]) -> PythonObject
Parametry
args
Argumenty pozycyjne lub słowa kluczowe dla wywoływalnej w Pythonie.
Deklaracja
init(tupleOf elements: PythonConvertible...)
Deklaracja
init<T : Collection>(tupleContentsOf elements: T) where T.Element == PythonConvertible
Deklaracja
init<T : Collection>(tupleContentsOf elements: T) where T.Element : PythonConvertible
Deklaracja
static func + (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func - (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func * (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func / (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func += (lhs: inout PythonObject, rhs: PythonObject)
Deklaracja
static func -= (lhs: inout PythonObject, rhs: PythonObject)
Deklaracja
static func *= (lhs: inout PythonObject, rhs: PythonObject)
Deklaracja
static func /= (lhs: inout PythonObject, rhs: PythonObject)
Deklaracja
static func & (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func | (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func ^ (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func &= (lhs: inout PythonObject, rhs: PythonObject)
Deklaracja
static func |= (lhs: inout PythonObject, rhs: PythonObject)
Deklaracja
static func ^= (lhs: inout PythonObject, rhs: PythonObject)
Deklaracja
prefix static func ~ (operand: `Self`) -> PythonObject
Deklaracja
public init<T>(exactly value: T) where T : BinaryInteger
Deklaracja
public typealias Magnitude = PythonObject
Deklaracja
public var magnitude: PythonObject { get }
Deklaracja
public prefix static func - (operand: `Self`) -> PythonObject
Deklaracja
public typealias Stride = PythonObject
Deklaracja
public func distance(to other: PythonObject) -> Stride
Deklaracja
public func advanced(by stride: Stride) -> PythonObject
Deklaracja
public static func == (lhs: PythonObject, rhs: PythonObject) -> Bool
Deklaracja
public static func != (lhs: PythonObject, rhs: PythonObject) -> Bool
Deklaracja
public static func < (lhs: PythonObject, rhs: PythonObject) -> Bool
Deklaracja
public static func <= (lhs: PythonObject, rhs: PythonObject) -> Bool
Deklaracja
public static func > (lhs: PythonObject, rhs: PythonObject) -> Bool
Deklaracja
public static func >= (lhs: PythonObject, rhs: PythonObject) -> Bool
Deklaracja
static func == (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func != (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func < (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func <= (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func > (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
static func >= (lhs: PythonObject, rhs: PythonObject) -> PythonObject
Deklaracja
public func hash(into hasher: inout Hasher)
Deklaracja
public typealias Index = PythonObject
Deklaracja
public typealias Element = PythonObject
Deklaracja
public var startIndex: Index { get }
Deklaracja
public var endIndex: Index { get }
Deklaracja
public subscript(index: PythonObject) -> PythonObject { get set }
Deklaracja
public struct Iterator : IteratorProtocol
Deklaracja
public func makeIterator() -> Iterator
Deklaracja
public init(booleanLiteral value: Bool)
Deklaracja
public init(integerLiteral value: Int)
Deklaracja
public init(floatLiteral value: Double)
Deklaracja
public init(stringLiteral value: String)
Deklaracja
public init(arrayLiteral elements: PythonObject...)
Deklaracja
public typealias Key = PythonObject
Deklaracja
public typealias Value = PythonObject
Deklaracja
public init(dictionaryLiteral elements: (PythonObject, PythonObject)...)