[Tutor] subclass not inheriting attributes?

Alan Gauld alan.gauld at btinternet.com
Tue Jan 4 02:07:37 CET 2011


"Alex Hall" <mehgcap at gmail.com> wrote

> class parent(object):
> def __init__(self, l=None):
>  if l is None: l=[]

l is a local variable inside init().

You wanted self.l...

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/





More information about the Tutor mailing list