On 15 Mar, 15:50, [EMAIL PROTECTED] (Alex Martelli) wrote: > Paul Boddie <[EMAIL PROTECTED]> wrote: > > Call me a traditionalist, but why wouldn't a factory function be good > > enough? > > That depends on whether you need name C1 to refer to a class, or not.
Right. > If you want name C1 to be usable outside this module as a class (to > subclass it, use with isinstance or issubclass, be available to an IDE's > classbrowser or other means of introspection including pydoc, etc), then > making name C1 refer to a function instead would not work. True. I can easily buy the argument about wanting to subclass C1, although you'd always have the real class available somewhere as well. For things like IDEs, class browsers and so on, I think more work needs to be done to make these things more "aware" - it sounds like they expect a more rigid language (like Java), but I do have some awareness of why it's tempting to let them operate on their current level of introspection. > > Or perhaps seeing more special methods and decorators just puts me in > > a grumpy mood. ;-) For me, the power of Python is derived from being > > able to do things like making callables "constructors" whilst > > providing some illusion that C1 (in this case) is a class. > > For me, OTOH, it's not just smoke and mirrors (or as you say > "illusion"), there's also plenty of real power, and __new__ is part of > that. Oh, I like the illusion! The illusion is what makes Python so powerful, after all. Paul -- http://mail.python.org/mailman/listinfo/python-list