Re: Recursion error in metaclass

2011-06-11 Thread Steven D'Aprano
On Sat, 11 Jun 2011 01:33:25 -0400, Terry Reedy wrote: On 6/10/2011 11:34 PM, Steven D'Aprano wrote: I have a metaclass in Python 3.1: class MC1(type): @staticmethod def get_mro(bases): print('get_mro called') return type('K', bases, {}).__mro__[1:] The call

Re: Recursion error in metaclass

2011-06-11 Thread Terry Reedy
On 6/11/2011 7:38 AM, Steven D'Aprano wrote: On Sat, 11 Jun 2011 01:33:25 -0400, Terry Reedy wrote: On 6/10/2011 11:34 PM, Steven D'Aprano wrote: I have a metaclass in Python 3.1: class MC1(type): @staticmethod def get_mro(bases): print('get_mro called')

Re: Recursion error in metaclass

2011-06-11 Thread Daniel Urban
On Sat, Jun 11, 2011 at 21:39, Terry Reedy tjre...@udel.edu wrote: What may not be obvious from the docs is that the metaclass calculation described in the doc section on class statements is carried out within type.__new__ (or after a possible patch, called from within that), so that type

Recursion error in metaclass

2011-06-10 Thread Steven D'Aprano
I have a metaclass in Python 3.1: class MC1(type): @staticmethod def get_mro(bases): print('get_mro called') return type('K', bases, {}).__mro__[1:] def __new__(cls, name, bases, dict): mro = None docstring = dict.get('__doc__') if docstring ==

Re: Recursion error in metaclass

2011-06-10 Thread Terry Reedy
On 6/10/2011 11:34 PM, Steven D'Aprano wrote: I have a metaclass in Python 3.1: class MC1(type): @staticmethod def get_mro(bases): print('get_mro called') return type('K', bases, {}).__mro__[1:] The call to type figures out the proper metaclass from bases and