newbie: confused with example in Learning Python 2nd Edition: can anyone give a hint

Dave Cole djc at object-craft.com.au
Tue Aug 24 00:02:22 EDT 2004


Steven Rumbalski wrote:
> Porky Pig Jr wrote:
> So the corrected code should look like:
> 
>>>>class Stack:
> 
>  ...     def __init__(self, data):
>  ...             self._data = list(data)
>  ...             self.push = _data.append
>  ...             self.pop = _data.pop

 >>>class Stack:
...     def __init__(self, data):
...             self._data = list(data)
...             self.push = self._data.append
...             self.pop = self._data.pop

-- 
http://www.object-craft.com.au



More information about the Python-list mailing list