Hello,
In Python, classes are objects. But there is no way to custom print a class
object. This would require some syntax such as the one commented out below:
With the current "foo = classmethod(foo)" mechanism custom printing for
class objects is not possible.
#!/usr/bin/python
class Foo:
def __str__(self):
return "foo"
#def classmethod __str__(cls):
# return "pythons bite"
foo = Foo()
s = "hello %s!" % foo # custom text here
print s
print Foo # no custom text here possible it seems, unless we call
# a staticmethod such as Foo.printMe()
Regards,
Neil