Skip to main content

Verifies if giving object is list or tuple; if not returns a list with it as single element.

Project description

Works as a shortcut to this:

thing_list = “single”

if not isinstance(thing_list, (list, tuple)):

thing_list = [thing_list]

for thing in thing_list:

do_something(thing)

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page