@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 }
ส่งคืน wrapper
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 สิ่งอันดับ
คำประกาศ
var tuple2: (PythonObject, PythonObject) { get }
แปลงเป็น 3 สิ่งอันดับ
คำประกาศ
var tuple3: (PythonObject, PythonObject, PythonObject) { get }
แปลงเป็น 4 สิ่งอันดับ
คำประกาศ
var tuple4: (PythonObject, PythonObject, PythonObject, PythonObject) { get }
เรียก
self
ด้วยอาร์กิวเมนต์ตำแหน่งที่ระบุเงื่อนไขเบื้องต้น
self
จะต้องเป็น Python ที่สามารถเรียกได้คำประกาศ
@discardableResult func dynamicallyCall( withArguments args: [PythonConvertible] = []) -> PythonObject
พารามิเตอร์
args
อาร์กิวเมนต์ตำแหน่งสำหรับ Python ที่เรียกได้
เรียก
self
ด้วยอาร์กิวเมนต์ที่ระบุเงื่อนไขเบื้องต้น
self
จะต้องเป็น Python ที่สามารถเรียกได้คำประกาศ
@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 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)...)