Skip to content

Issue with functions are default arguments #143

Open
@tjhunter

Description

@tjhunter

The following code:

import dds

def f(): return 1

def g(arg = f):
    return arg()

dds.eval(g2)

causes an analyzer error:

dds.structures.DDSException: The type <class 'function'> is currently not supported. The only supported types are 'well-known' types that are part of the standard data structures in the python library. If you think your data type should be supported by DDS, please open a request ticket. General Python classes will not be supported since they can carry arbitrary state and cannot be easily compared. Consider using a dataclass, a dictionary or a named tuple instead.

The current workaround is to not have a function as a default argument:

def g2(arg = None):
    arg = arg or f
    return arg()

dds.eval(g2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions