what is self._base?

Martin von Loewis loewis at informatik.hu-berlin.de
Fri Dec 14 08:56:09 EST 2001

Benjamin Tai <bt98 at doc.ic.ac.uk> writes:

> import stacktype
> class Stack:
>   def __init__(self, start=None):
>     self._base = start or stacktype.Stack()
> However I can't find any documents/explanation for the following:
> 1) What is  "_base"

It just is an arbitrary member name; it has no pre-defined meaning in

> 2) What is  "start=None"

start is the parameter, None is the default value.

> 3) Why can't I just write  "self = stacktype.Stack()"

self is also a parameter (of __init__). So if you assign to self, this
assignment loses its meaning once __init__ returns.


More information about the Python-list mailing list