By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,965 Members | 1,450 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,965 IT Pros & Developers. It's quick & easy.

Examples / Links needed

P: n/a
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 = []
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
May 7 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In <11**********************@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
May 7 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.