[Python-Dev] Let's get rid of unbound methods (original) (raw)
Barry Warsaw barry at python.org
Wed Jan 5 18:26:38 CET 2005
- Previous message: [Python-Dev] Let's get rid of unbound methods
- Next message: [Python-Dev] Let's get rid of unbound methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 2005-01-05 at 10:37, Glyph Lefkowitz wrote:
One approach I have taken in order to avoid copiously over-documenting every super() using class is to decouple different phases of initialization by making init as simple as possible (setting a few attributes, resisting the temptation to calculate things), and then providing class methods like '.fromString' or '.forUnserialize' that create instances that have been completely constructed for a particular purpose. That way the signatures are much more likely to line up across inheritance hierarchies. Perhaps this should be a suggested "best practice" when using super() as well?
Yep, I've done the same thing. It's definitely a good practice.
-Barry
-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 307 bytes Desc: This is a digitally signed message part Url : http://mail.python.org/pipermail/python-dev/attachments/20050105/f78f1142/attachment.pgp
- Previous message: [Python-Dev] Let's get rid of unbound methods
- Next message: [Python-Dev] Let's get rid of unbound methods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]