On 9/2/07, Brett Cannon <[EMAIL PROTECTED]> wrote: > PEP 3115 says a metaclass' __prepare__ takes two positional arguments, > name and bases. But the example has it actually accept an arbitrary > number of arguments: name and then everything else is bound to bases. > > Which happens to be true? I'm too tired to even fully trust that I am > reading the PEP correctly, so I am not about to try to write an > example to see which is correct and come up with a coherent rewording > if I am right about what is wrong. =)
I think you're misreading what you think is an example. I'm assuming you're referring to this code: def prepare_class(name, *bases, metaclass=None, **kwargs): if metaclass is None: metaclass = compute_default_metaclass(bases) prepare = getattr(metaclass, '__prepare__', None) if prepare is not None: return prepare(name, bases, **kwargs) else: return dict() This indeed *defines* a function with a *bases argument, but it is not called __prepare__! It *calls* __prepare__ passing it name and bases, i.e. the 2nd argument to prepare is a tuple of bases. The only example defining __prepare__ later in the PEP takes two positional arguments (name and bases again). -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com