Re: Python style: to check or not to check args and data members

2006-09-03 Thread Alex Martelli
Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: ... > > >>> class A(object): note that A is new-style... > >>> class x: ...while x is old-style. Here's a small script to explore the problem...: import sys class oldstyle: def __getitem__(self, index): print index, class newstyle(object,

Re: Python style: to check or not to check args and data members

2006-09-03 Thread Jean-Paul Calderone
On Sun, 03 Sep 2006 16:29:11 +0200, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Paul Rubin a écrit : >> Bruno Desthuilliers <[EMAIL PROTECTED]> writes: >> >>>I've rarely encoutered "silent" data corruption with Python - FWIW, I >>>once had such a problem, but with a lower-level statically type

Re: Python style: to check or not to check args and data members

2006-09-03 Thread Bruno Desthuilliers
Paul Rubin a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > >>I've rarely encoutered "silent" data corruption with Python - FWIW, I >>once had such a problem, but with a lower-level statically typed >>language (integer overflow), and I was a very newbie programmer by that >>time. Usua

Re: Python style: to check or not to check args and data members

2006-09-02 Thread Paul Rubin
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > I've rarely encoutered "silent" data corruption with Python - FWIW, I > once had such a problem, but with a lower-level statically typed > language (integer overflow), and I was a very newbie programmer by that > time. Usually, one *very quickly* no

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Joel Hedlund
> Oh, I was just addressing your bit about not knowing unit tests. > Doctests can be quicker to put together and have only a small learning > curve. OK, I see what you mean. And you're right. I'm struggling mightily right now with trying to come up with sane unit tests for a bunch of generalized

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Paddy
Joel Hedlund wrote: > > You might try doctests, they can be easier to write and fit into the > > unit test framework if needed. > > While I firmly believe in keeping docs up to date, I don't think that > doctests alone can solve the problem of maintaining data integrity in > projects with more com

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Joel Hedlund
> You might try doctests, they can be easier to write and fit into the > unit test framework if needed. While I firmly believe in keeping docs up to date, I don't think that doctests alone can solve the problem of maintaining data integrity in projects with more comlex interfaces (which is what

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Paddy
Joel Hedlund wrote: > > Hmmm... So. I should build grimly paranoid parsers for external data, use > duck-typed interfaces everywhere on the inside, and simply callously > disregard developers who are disinclined to read documentation? I could do > that. > > > if you're really serious, unit tests

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Bruno Desthuilliers
Joel Hedlund wrote: >> I still wait for a >> proof that it leads to more robust programs - FWIW, MVHO is that it >> usually leads to more complex - hence potentially less robust - code. > > MVHO? I assume you are not talking about Miami Valley Housing > Opportunities here, Nope --> My Very Humbl

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Joel Hedlund
> I still wait for a > proof that it leads to more robust programs - FWIW, MVHO is that it > usually leads to more complex - hence potentially less robust - code. MVHO? I assume you are not talking about Miami Valley Housing Opportunities here, but bloat probably leads to bugs, yes. > Talking ab

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Bruno Desthuilliers
Joel Hedlund wrote: >> I'm not sure that trying to fight against the language is a sound >> approach, whatever the language. > > That's the very reason I posted in the first place. I feel like I'm > fighting the language, and since python at least to me seems to be so > well thought out in all ot

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Joel Hedlund
> I'm not sure that trying to fight against the language is a sound > approach, whatever the language. That's the very reason I posted in the first place. I feel like I'm fighting the language, and since python at least to me seems to be so well thought out in all other aspects, the most obviou

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Joel Hedlund
> And while we're at it : please avoid top-posting. Yes, that was sloppy. Sorry. /Joel -- http://mail.python.org/mailman/listinfo/python-list

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Bruno Desthuilliers
Joel Hedlund wrote: > Bruno >> Your email address seem to be wrong. let's say "disguised" !-) > I tried to reply to you > directly in order to avoid thread bloat but my mail bounced. I don't think it's a good idea anyway - this thread is on topic here and may be of interest to others too IMHO

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Bruno Desthuilliers
Joel Hedlund wrote: >> Short answer: Use Traits. Don't invent your own mini-Traits. > > Thanks for a quick and informative answer! I'll be sure to read up on > the subject. (And also: thanks Bruno for your contributions!) > >> Types are very frequently exactly the wrong thing you want to check fo

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Joel Hedlund
Bruno >> Your email address seem to be wrong. I tried to reply to you directly in order to avoid thread bloat but my mail bounced. Thanks for the quick reply though. I've skimmed through some docs on your suggestions and I'll be sure to read up on them properly later. But as I said to Robert Ke

Re: Python style: to check or not to check args and data members

2006-09-01 Thread Joel Hedlund
> Short answer: Use Traits. Don't invent your own mini-Traits. Thanks for a quick and informative answer! I'll be sure to read up on the subject. (And also: thanks Bruno for your contributions!) > Types are very frequently exactly the wrong thing you want to check for. I see what you mean. Al

Re: Python style: to check or not to check args and data members

2006-08-31 Thread Bruno Desthuilliers
Joel Hedlund a écrit : > Hi! > > The question of type checking/enforcing has bothered me for a while, (snip) > > I've also whipped up some examples in order to put the above questions > in context and for your amusement. :-) (snip) > These are the attached modules: > > * nocheck_module.py: >

Re: Python style: to check or not to check args and data members

2006-08-31 Thread Robert Kern
Joel Hedlund wrote: > Hi! > > The question of type checking/enforcing has bothered me for a while, and > since this newsgroup has a wealth of competence subscribed to it, I > figured this would be a great way of learning from the experts. I feel > there's a tradeoff between clear, easily readda

Python style: to check or not to check args and data members

2006-08-31 Thread Joel Hedlund
Hi! The question of type checking/enforcing has bothered me for a while, and since this newsgroup has a wealth of competence subscribed to it, I figured this would be a great way of learning from the experts. I feel there's a tradeoff between clear, easily readdable and extensible code on one