Examples / Links needed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andy

    #1

    Examples / Links needed

    Gurus, I'm looking for definite examples (pardon me if I'm not clear
    here) on Stack class...Somewha t 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.__numerato r *= other.__numerat or
    self.__denomina tor *= other.__denomin ator
  • Marc 'BlackJack' Rintsch

    #2
    Re: Examples / Links needed

    In <1178515847.621 303.270280@o5g2 000hsb.googlegr oups.com>, Andy wrote:
    Gurus, I'm looking for definite examples (pardon me if I'm not clear
    here) on Stack class...Somewha t 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.__numerato r *= other.__numerat or
    self.__denomina tor *= other.__denomin ator
    .
    .
    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

    Comment

    Working...