Skip to content

Commit

Permalink
lib.util: Add is_subclass()
Browse files Browse the repository at this point in the history
A more sensible version of the issubclass() builtin.
  • Loading branch information
MurphyMc committed May 19, 2013
1 parent bb01405 commit 569e90a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pox/lib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,16 @@ def tryConnect ():
makePinger = make_pinger # Deprecated


def is_subclass (cls, classinfo):
"""
A more sensible version of the issubclass builtin
"""
try:
return issubclass(cls, classinfo)
except TypeError:
return False


def str_to_bool (s):
"""
Given a string, parses out whether it is meant to be True or not
Expand Down

0 comments on commit 569e90a

Please sign in to comment.