Examples / Links needed
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Mon May 7 03:21:36 EDT 2007
In <1178515847.621303.270280 at o5g2000hsb.googlegroups.com>, Andy wrote:
> Gurus, I'm looking for definite examples (pardon me if I'm not clear
> here) on Stack class...Somewhat like this :
>
> class Stack(object):
> def __init__(self__)
> self.__contents = []
I don't know what to tell you here without writing the thing for you. Ask
yourself what operations a `Stack` needs and look at the documentation for
`list` operations. It's pretty easy to map the stack operations to `list`
ones.
> and ad hoc implementation of a class based on number system like for
> example somewhat like this
>
>
> def __imult__(self, other):
> self.__numerator *= other.__numerator
> self.__denominator *= other.__denominator
> .
> .
> return self
So what exactly is your problem? Take a "number like", look at the
methods it implements and do this for your "number like" class.
> I'm not satisfied with Python Docs.
Why? What does `Emulating numeric types`_ in the reference manual lack in
your opinion?
.. _Emulating numeric types: http://docs.python.org/ref/numeric-types.html
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list