At Tuesday 29/8/2006 02:45, Antoon Pardon wrote:
That may be true. But one may wonder if this is a failing of the
programmer or a failing of the language that doesn't support
such things.
In any case, I don't see how this supports the original claim that
strict type checking input params is
On 2006-08-29, Simon Forman [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
On 2006-08-28, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
There seem to be enough problems that work with ints but not with
floats. In such a case enforcing that the number you work with
is
On 2006-08-29, Gabriel Genellina [EMAIL PROTECTED] wrote:
At Tuesday 29/8/2006 02:45, Antoon Pardon wrote:
That may be true. But one may wonder if this is a failing of the
programmer or a failing of the language that doesn't support
such things.
In any case, I don't see how this supports
Antoon Pardon wrote:
On 2006-08-28, Scott David Daniels [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
On 2006-08-25, Simon Forman [EMAIL PROTECTED] wrote:
...
Generally asserts should be used to enforce invariants of your code
(as opposed to typechecking), or to check certain things
Simon Forman wrote:
If you have a reason to restrict your code to using only ints (perhaps
you're packing them into an array of some sort, or passing them to a C
extension module) then yes, of course it's appropriate.
I politely disagree. Rather than an interface that demands an actual
int,
On 2006-08-29, Jonathan Gardner [EMAIL PROTECTED] wrote:
Simon Forman wrote:
If you have a reason to restrict your code to using only ints (perhaps
you're packing them into an array of some sort, or passing them to a C
extension module) then yes, of course it's appropriate.
I politely
Antoon Pardon wrote:
On 2006-08-29, Gabriel Genellina [EMAIL PROTECTED] wrote:
At Tuesday 29/8/2006 02:45, Antoon Pardon wrote:
That may be true. But one may wonder if this is a failing of the
programmer or a failing of the language that doesn't support
such things.
In any case, I don't see
On 2006-08-29, Steve Holden [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
On 2006-08-29, Gabriel Genellina [EMAIL PROTECTED] wrote:
At Tuesday 29/8/2006 02:45, Antoon Pardon wrote:
That may be true. But one may wonder if this is a failing of the
programmer or a failing of the language that
On 2006-08-25, Simon Forman [EMAIL PROTECTED] wrote:
asincero wrote:
Would it be considered good form to begin every method or function with
a bunch of asserts checking to see if the parameters are of the correct
type (in addition to seeing if they meet other kinds of precondition
Antoon Pardon wrote:
On 2006-08-25, Simon Forman [EMAIL PROTECTED] wrote:
...
Generally asserts should be used to enforce invariants of your code
(as opposed to typechecking), or to check certain things while
debugging.
I don't understand this argument. Can't type checking be seen as
On 2006-08-28, Scott David Daniels [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
On 2006-08-25, Simon Forman [EMAIL PROTECTED] wrote:
...
Generally asserts should be used to enforce invariants of your code
(as opposed to typechecking), or to check certain things while
debugging.
I don't
Antoon Pardon wrote:
There seem to be enough problems that work with ints but not with
floats. In such a case enforcing that the number you work with
is indeed an int seems fully appropiate.
I've _never_ seen a case where enforcing types in the manner of the OP
is appropriate.
It fails with
asincero wrote:
Would it be considered good form to begin every method or function
with a bunch of asserts checking to see if the parameters are of the
correct type [...]
This is something I miss from working with more stricter languages
like C++, where the compiler will tell you if a
On 2006-08-28, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
There seem to be enough problems that work with ints but not with
floats. In such a case enforcing that the number you work with
is indeed an int seems fully appropiate.
I've _never_ seen a case where enforcing
At Tuesday 29/8/2006 01:28, Antoon Pardon wrote:
Antoon Pardon wrote:
There seem to be enough problems that work with ints but not with
floats. In such a case enforcing that the number you work with
is indeed an int seems fully appropiate.
I've _never_ seen a case where enforcing types in
Antoon Pardon wrote:
On 2006-08-28, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
There seem to be enough problems that work with ints but not with
floats. In such a case enforcing that the number you work with
is indeed an int seems fully appropiate.
I've _never_
On 2006-08-29, Gabriel Genellina [EMAIL PROTECTED] wrote:
At Tuesday 29/8/2006 01:28, Antoon Pardon wrote:
Antoon Pardon wrote:
There seem to be enough problems that work with ints but not with
floats. In such a case enforcing that the number you work with
is indeed an int seems fully
asincero wrote:
Would it be considered good form to begin every method or function with
a bunch of asserts checking to see if the parameters are of the correct
type (in addition to seeing if they meet other kinds of precondition
constraints)? Like:
def foo(a, b, c, d):
assert
Simon Forman [EMAIL PROTECTED] wrote:
8-
| BTW, speaking of strictness, more stricter is invalid English,
| just stricter is the correct form. ;-)
or alternatively the construct more strict is also acceptable - Hendrik
--
In [EMAIL PROTECTED], asincero
wrote:
def foo(a, b, c, d):
assert type(a) == str
assert type(b) == str
assert type(c) == int
assert type(d) == bool
# rest of function follows
This is something I miss from working with more stricter languages like
Arcadio Would it be considered good form to begin every method or
Arcadio function with a bunch of asserts checking to see if the
Arcadio parameters are of the correct type (in addition to seeing if
Arcadio they meet other kinds of precondition constraints)?
If it works for you.
asincero wrote:
Would it be considered good form to begin every method or function with
a bunch of asserts checking to see if the parameters are of the correct
type (in addition to seeing if they meet other kinds of precondition
constraints)? Like:
def foo(a, b, c, d):
assert
asincero wrote:
Would it be considered good form to begin every method or function with
a bunch of asserts checking to see if the parameters are of the correct
type (in addition to seeing if they meet other kinds of precondition
constraints)? Like:
def foo(a, b, c, d):
assert
On 24 Aug 2006 20:53:49 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
That's bad form. If you insist on doing something like this, at least
use isinstance(a, str) instead of typeof. But even that breaks duck
typing; if a is a unicode string, that'll fail when the function may
work fine
24 matches
Mail list logo