On Jan 8, 7:42 am, Steven D'Aprano wrote:
> On Sat, 07 Jan 2012 17:16:22 -0800, lars van gemerden wrote:
> > Hello,
>
> > I have an error message i do not understand:
>
> > My code is in essence:
>
> The code you give works fine. It does not show the error you say it does.
> Please test your code
On Sat, 07 Jan 2012 17:16:22 -0800, lars van gemerden wrote:
> Hello,
>
> I have an error message i do not understand:
>
> My code is in essence:
The code you give works fine. It does not show the error you say it does.
Please test your code before posting and ensure it actually fails the way
On Sat, 07 Jan 2012 22:08:22 -0800, 8 Dihedral wrote:
[...]
> The class is defined in a silly way.
> In python declaring a class with only trivial properties added is not
> very python at all.
The example given looks like a Mixin class, which is perfectly acceptable
in Python.
--
Steven
A list is a container.
Chris Angelico於 2012年1月8日星期日UTC+8上午9時27分06秒寫道:
> On Sun, Jan 8, 2012 at 12:16 PM, lars van gemerden
> wrote:
> > Hello,
> >
> > I have an error message i do not understand:
> >
> > My code is in essence:
> >
> > b = B([1,2,3,4])
> >
> > error:
> > b = B([0,1,2,3,4])
>
On Sun, Jan 8, 2012 at 12:16 PM, lars van gemerden wrote:
> Hello,
>
> I have an error message i do not understand:
>
> My code is in essence:
>
> b = B([1,2,3,4])
>
> error:
> b = B([0,1,2,3,4])
> TypeError: B() takes exactly 2 arguments (1 given)
Your code doesn't quite match your error mess
Hello,
I have an error message i do not understand:
My code is in essence:
class A(object):
#no __new__ or __init__
def meth1(self, args):
#some code
def meth2(self, args):
#some code
class B(list, A)
pass
b = B([1,2,3,4])
error:
Traceback (most recent call last):