Skip to content

optimized hasproperty(o::Py, attr) = pyhasattr(o, attr) #157

Closed
@stevengj

Description

@stevengj

Currently, hasproperty(o, attr) works by falling back to Julia's default method, which checks attr in propertynames(o). This is functional but rather inefficient because it first constructs the propertynames list.

Since you already have an optimized pyhasattr method, it seems like you should just define:

hasproperty(o::Py, attr::Symbol) = hasproperty(o, String(attr))
hasproperty(o::Py, attr::AbstractString) = pyhasattr(o, attr)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions