Python객체

@dynamicCallable
@dynamicMemberLookup
public struct PythonObject
1
extension PythonObject : CustomPlaygroundDisplayConvertible
extension PythonObject : CustomStringConvertible
자2
extension PythonObject : CustomReflectable
extension PythonObject : PythonConvertible, ConvertibleFromPython
extension PythonObject : SignedNumeric
extension PythonObject : Strideable
extension PythonObject : Equatable, Comparable
extension PythonObject : Hashable
표시자10 l10n-
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 에 대한 참조 횟수 포인터로 구현됩니다.

  • 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 의 호출 가능한 버전을 반환합니다. 호출 시 기본 Python 함수가 Python 예외를 발생시키는 경우 결과는 Swift 오류를 발생시킵니다.

    선언

    var throwing: ThrowingPythonObject { get }
  • 멤버 액세스가 가능한 PythonObject 래퍼를 반환합니다.

    선언

    var checking: CheckingPythonObject { get }
  • 선언

    subscript(dynamicMember memberName: String) -> PythonObject { get nonmutating set }
  • 키를 나타내는 지정된 PythonConvertible 값에 해당하는 요소에 액세스합니다.

    메모

    이는 Python의 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 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 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)...)