Skip to content

Remove VarName from codebase #7843

Open
@ricardoV94

Description

@ricardoV94

Description

Why are we defining a new string type? An alias is sufficient if we even need it, but I think str is just fine. Also all PyTensor variables have a name attribute we don't need to call getattr(variable, "name") it may just be None

VarName = NewType("VarName", str)

pymc/pymc/util.py

Lines 253 to 255 in f6bfdfd

def get_var_name(var) -> VarName:
"""Get an appropriate, plain variable name for a variable."""
return VarName(str(getattr(var, "name", var)))

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions