quiet conversion functions

Robert Kern robert.kern at gmail.com
Wed Apr 12 22:22:47 EDT 2006


Tim Chase wrote:
> Are there existing "quiet" conversion functions?  Kin of 
> int() and float()?

Not in the standard library. Nor will there be. It goes against the development
philosophy of the core Python development team.

> My aim would be to call a function that would guarntee that 
> the result was of the defined type, choosing sensible 
> defaults if needed.

Only you know what "sensible" is in your context, so you get to write the function.

-- 
Robert Kern
robert.kern at gmail.com

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco




More information about the Python-list mailing list