Paul Rubin wrote:
> [Type checking] should be left on. Leaving it in for development
> and turning it off for production is like wearing a parachute
> during ground training and taking it off once you're in the air.
Why isn't it like practicing the trapeze with a net but
going without a net when
"Stephen Thorne" <[EMAIL PROTECTED]> wrote:
> Unresolved Problems:
> 1) How do you handle duck types, i.e. a method that accepts StringIO,
> cStringIO or any other object that has a .readlines(), .seek() and
> .read() method?
I think the 'proper' way of checking duck types (among other things) is
Thank you very much for reminding me. I have been sloppy.
It should have said static type checking.
ciao
Skip Montanaro wrote:
> >> Eiffel (language) has both type checking and design by contract.
> >> Python lacks both.
>
> Actually, Python is strongly typed. It's just dynamically instead o
Stephen Thorne <[EMAIL PROTECTED]> writes:
> > It should be left on. Leaving it in for development and turning it
> > off for production is like wearing a parachute during ground training
> > and taking it off once you're in the air.
> So we can't use this for a case where we have an extremely lar
On 08 Jan 2005 15:50:48 -0800, Paul Rubin
<"http://phr.cx"@nospam.invalid> wrote:
> Stephen Thorne <[EMAIL PROTECTED]> writes:
> > Unresolved Problems:
> > 1) How do you handle duck types, i.e. a method that accepts StringIO,
> > cStringIO or any other object that has a .readlines(), .seek() and
>
Stephen Thorne <[EMAIL PROTECTED]> writes:
> Unresolved Problems:
> 1) How do you handle duck types, i.e. a method that accepts StringIO,
> cStringIO or any other object that has a .readlines(), .seek() and
> .read() method?
That should really be done through having those classes inherit a
file-op
On Fri, 7 Jan 2005 20:01:50 +0200, George Sakkis <[EMAIL PROTECTED]> wrote:
> > Hi George,
> > it would be nice to see how you have tackled
> > the task.
> > Maybe we will have a checker
> > module in Python one day... ;-)
>
> I posted my module on http://rafb.net/paste/results/voZYTG78.html and i
>> Eiffel (language) has both type checking and design by contract.
>> Python lacks both.
Actually, Python is strongly typed. It's just dynamically instead of
statically typed.
Skip
--
http://mail.python.org/mailman/listinfo/python-list
Thank you very much. It is really a very elegant piece of code :-)
Eiffel (language) has both type checking and design by contract.
Python lacks both.
Your module tackles type checking, I
tried to execute arbitrary code before
and after function execution to realize
runtime assertions.
I wonder i
> Hi George,
> it would be nice to see how you have tackled
> the task.
> Maybe we will have a checker
> module in Python one day... ;-)
I posted my module on http://rafb.net/paste/results/voZYTG78.html and its unit
test on
http://rafb.net/paste/results/MYxMQW95.html. Any feedback will be appreci
# Google-News won't let be post a follow-up right now!
# Google-Beta-News destroys the formatting :-(
# So I'll start a new thread.
Hi Stephen
I have not read anything about the
"framehack lambda replacement" yet,
but I do compile the pre- and
postconditions. Syntax erros e.g.
will be raised if th
Hi Stephen
I have not read anything about the
"framehack lambda replacement" yet,
but I do compile the pre- and
postconditions. Syntax erros e.g.
will be raised if the module
is compiled. Although I must admit
that your code snippets look more like
compiled code ;-)
Hi Robert
thanks for the link t
"Robert Brewer" <[EMAIL PROTECTED]> wrote:
> Ian Bicking was just talking about @require decorators:
> http://blog.ianbicking.org/already-under-our-noses.html
>
> @require(int, int)
> def gcd(a, b):
> ...
>
> If we made a "checker" module for such things in the stdlib, we could
> write most of
Stephen Thorne wrote:
> On 6 Jan 2005 13:33:42 -0800, Rittersporn
> <[EMAIL PROTECTED]> wrote:
> > @condition("number>0 and number<2","result>=0")
> > def sqrt(number):
> > import math
> > return math.sqrt(number)
> >
> > @condition("list(seq) is not None","sum(seq)==result")
> >
On 6 Jan 2005 13:33:42 -0800, Rittersporn <[EMAIL PROTECTED]> wrote:
> @condition("number>0 and number<2","result>=0")
> def sqrt(number):
> import math
> return math.sqrt(number)
>
> @condition("list(seq) is not None","sum(seq)==result")
> def my_sum(seq):
> tmp=0
>
My humble attempt to model pre/postconditions with
decorators :-) It's also my first experiment
with decorators.
If you have any ideas or thoughts on how to
improve the code snippet, I'll be happy to
learn more.
Enjoy :-)
def condition(pretext,posttext=""):
16 matches
Mail list logo