TG <[EMAIL PROTECTED]> wrote [something like]:
>from array import array
>class Vector(array):
>    def __init__(self,size):
>        array.__init__('f')
>
>v = Vector('c')
>print repr(v)
>
>will output :
>
>array('c')

Is this a case of new-sytle classes being confusing? Because
I'm certainly confused. I guess what's needed is:

class Vector(array):
    def __new__(cls, size):
        self = array.__new__(array, 'f')
        ...
        return self

But how does one determine what classes need to have __init__
overridden and which __new__ when subclassing?

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to