overriding a tuple's __init__

Aahz aahz at pythoncraft.com
Mon Aug 18 18:16:39 EDT 2003


In article <bhricm$v4d$0 at 216.39.172.122>, Bengt Richter <bokr at oz.net> wrote:
>
>so far, just
>
>    class pair(tuple): pass
>
>should do it, no? Unless you want to take the name as suggesting that
>length 2 should be enforced. Don't know what other methods are planned,
>but ISTM you get the vanilla __new__ for free. Or am I missing something?

Certainly; I'm just illustrating the principle if you wanted to do
something useful.  ;-)
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

This is Python.  We don't care much about theory, except where it intersects 
with useful practice.  --Aahz




More information about the Python-list mailing list