3 number and dot..
Roberto Bonvallet
rbonvall at gmail.com
Fri Nov 2 16:19:21 EDT 2007
On 2 nov, 14:54, Steven D'Aprano <st... at REMOVE-THIS-
cybersource.com.au> wrote:
> Not necessarily. Something duck typing is too liberal in what it accepts.
> You might want convert(math.pi) to raise an exception
What I meant was that the function should not reject unnecessarily non-
numeric
things that can be converted to a number, like a string. However,
you're right:
numeric things that are not integers should not be treated silently as
if they
were.
> although I'd suggestion an assert is the wrong test. A better test would be an
> explicit type check with raise.
I completely agree.
Cheers,
--
Roberto Bonvallet
More information about the Python-list
mailing list