Skip to content

[Query]: does helpersConvertInputToList.py always need to UnwrapElement ? #2

@adambear82

Description

@adambear82

Thanks for starting this resource, looks really useful :)

# Custom method to convert single items to a list to iterate over, also unwraps the items.
def toList(x): # the name of the function
if isinstance(x,list): return UnwrapElement(x) # if the input element is a single thing, return it as a list.
else : return [UnwrapElement(x)] # if the input thing was a list all along, just return that

I was wondering why you used UnwrapElement is that always necessary?
or do you include it just in case its necessary?
sometimes I use this single line that I picked up from looking at packages

if not isinstance(inputs, list): inputs = [inputs]

which is pretty similar but skips over doing anything that is already a list so there wouldn't be the opportunity to UnwrapElement for objects that are already in a list

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