Hackbard
Hackbard

Reputation: 450

Type check in Zope

I want to check if an variabel has type list

if isinstance(filter, type([])) != True:
    filer = [filter]

when i try this zope can't find type.

And that i cant use:

isinstance(filter, list)

couse Zope means "list" is an Variabel

Upvotes: 1

Views: 467

Answers (1)

Wilduck
Wilduck

Reputation: 14126

When writing python code it's important not to overwrite the builtin variables.

It looks like you used list as a variable name, preventing isinstance from working as expected. It is also worth noting that filter is a builtin as well, and you should probably find another name for whatever you're storing in filter.

Upvotes: 2

Related Questions