Adjust output of values() classmethod
The way it was before, the function would also return itself. This isn't really a problem here, but if someone takes this function as a guide (like me) they can run into problems when iterating over the returned array, as it contains an element representing "values()" itself. Another approach would be make use of the inspect package and replace name="values" with inspect.ismethod(name)
This commit is contained in:
parent
d3cc96523e
commit
fd1016695f
1 changed files with 2 additions and 2 deletions
|
|
@ -34,7 +34,7 @@ class BedTypes(object):
|
|||
|
||||
@classmethod
|
||||
def values(cls):
|
||||
return [getattr(cls, name) for name in cls.__dict__ if not name.startswith("__")]
|
||||
return [getattr(cls, name) for name in cls.__dict__ if not (name.startswith("__") or name="values")]
|
||||
|
||||
class BedOrigin(object):
|
||||
LOWERLEFT = "lowerleft"
|
||||
|
|
@ -42,7 +42,7 @@ class BedOrigin(object):
|
|||
|
||||
@classmethod
|
||||
def values(cls):
|
||||
return [getattr(cls, name) for name in cls.__dict__ if not name.startswith("__")]
|
||||
return [getattr(cls, name) for name in cls.__dict__ if not (name.startswith("__") or name="values")]
|
||||
|
||||
class PrinterProfileManager(object):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue