On Dec 30, 2008, at 5:22 AM, osimons wrote:

>
> On Dec 29, 5:48 pm, "Erik Bray" <[email protected]> wrote:
>> On Thu, Dec 25, 2008 at 8:24 AM, anatoly techtonik  
>> <[email protected]> wrote:
>>> While learning Trac component architecture lesson that basically  
>>> means
>>> that "extension point plugin instance will be created with the same
>>> ComponentManager where extension point provider is" I made some
>>> adjustments to core.py to understand its structure.
>>
>>> Attached 0.11 branch diff changes __new__ to __init__ in component
>>> metaclass to convey the idea that metaclass doesn't control the
>>> component creation, but merely adjusts it and fills a registry. Some
>>> other lines are changed to increase readability.
>>
>>> It would be nice to receive some feedback and to know whatever these
>>> changes are worthy to be committed.
>>
>>> Happy Holidays!
>>
>> This seemed unintuitive to me at first, but after thinking about it
>> I'm inclined to agree that it *does* make more sense.  As you say,
>> there's no particular reason here to override the metaclass's  
>> __new__.
>>  Without doing so it will still create the class as expected, and
>> calling ComponentMeta() will return the the class.  So overriding
>> type.__init__ seems to make more sense.
>
> A number of plugins override __init__(). Wouldn't they then have to
> understand the needs of inherited base and metaclass, and make sure
> that gets initialised correctly before they can go about their own
> initialization? I haven't read the patch or the consequences in
> detail, but if so that would add a new level of complexity to making
> plugins - and provide a whole new set of errors to current and future
> plugins?

The __init__ of the metaclass isn't related to the __init__ of the  
class. Its purely a stylistic decision in this case, though __new__  
does allow a small more flexibility that __init__ in that you can  
return something other than an instance of the class. Not sure what  
you would use that for with a metaclass though.

--Noah

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/trac-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to