possibly a dumb question

jepler at unpythonic.net jepler at unpythonic.net
Sat Jun 29 22:20:57 EDT 2002


class foo(object):
    def __new__(*args): return 0

x = foo(0)
print x, type(x)

But if you want the constructor for "foo" to return a value that is not
an instance of "foo", why not let "foo" be a function?  Since both
functions and classes are callables, it's no problem allowing both anywhere
a callable object can be used...

Jeff





More information about the Python-list mailing list