[Patches] [ python-Patches-478374 ] __class_init__ method for classes

noreply@sourceforge.net noreply@sourceforge.net
Fri, 09 Nov 2001 09:38:37 -0800


Patches item #478374, was opened at 2001-11-05 09:28
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=478374&group_id=5470

Category: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Thomas Heller (theller)
Assigned to: Nobody/Anonymous (nobody)
Summary: __class_init__ method for classes

Initial Comment:
ExtensionClass did include a __class_init__ class-
method,
which has been called at the end of class creation.

I've uploaded a (simple minded) patch to fileobject.c, 
which implements the same behaviour for new style 
classes.
It is simple minded because it only iterates over the
tp_base member and not over tp_bases.

Any chance this could be included in Python 2.2?


----------------------------------------------------------------------

>Comment By: Thomas Heller (theller)
Date: 2001-11-09 09:38

Message:
Logged In: YES 
user_id=11105

I'll close this, for two reasons:

- Neither patch seems working correctly

- I can achieve what I want with attribute descriptors

This shall teach me not to request new features too early ;-
)

----------------------------------------------------------------------

Comment By: Thomas Heller (theller)
Date: 2001-11-09 00:04

Message:
Logged In: YES 
user_id=11105

The simple minded approach is probably totally wrong, a 
better one seems to be to call the __init_class__ class 
method (if one is found) from within object_init.
The attached file object_init.txt contains this patch.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=478374&group_id=5470