Re: error handling in user input: is this natural or just laborious




sam a écrit :

(snip)
i'm still in the early stages, and am trying to code something simple
and interactive to get the percentages of the portfolio in the five
different investment categories. i thought i'd get in with the error
handling early so if someone types in something wrong (like a word), or
the numbers don't add up to 100%, the error would be caught immediately
and the user sent back to the start of the loop.
(snip)

You may want to have a look at the formencode package. While mostly
used in web apps, it's perfectly usable for all kind of
python<->outside world data conversion/validation.

HTH

.



Relevant Pages

  • Re: error handling in user input: is this natural or just laborious
    ... In message, sam ... different investment categories. ... "type": int, ... "Please enter a %s index for the portfolio: ...
    (comp.lang.python)
  • Re: APPL - 200.68 A Share!!
    ... that AAPL is a good bet at its current price as a long-term investment. ... AAPL is doing. ... buying a stock at a specific time than believing that it's overvalued. ...
    (comp.sys.mac.advocacy)
  • Re: Another Scientific White Elephant?
    ... that's expensive and might not return anything for its investment? ... Remember the SSC? ... When the Kennedy administration took office, the USAF had several models of bombers in its fleet. ...
    (sci.research.careers)
  • Re: Which Lathe (groan)
    ... I was at Herbert's for about 4 years just before their demise. ... Giving bean counters too much power has been a big mistake IMO in this ... in hindsight - flawed and was a very substantial investment. ...
    (uk.rec.models.engineering)
  • Re: The concept of proper time
    ... Without it, Einstein's notion of letting ... > Sam and Joe are housepainters, ... Joe in another thread, so I snip it ...
    (sci.physics)