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:
Florian Heilmann authored and GitHub committed 2016-10-22 12:39:16 +02:00
1 parent d3cc96523e
commit fd1016695f
1 file changed
+2 -2
+2 -2
View File
@@ -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):
"""