[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Python or Perl for a Debian maintainance project?



On Sat, Feb 21, 2004 at 11:47:08AM +0100, Florent Rougon wrote:
> Andrew Suffield <asuffield@debian.org> wrote:
> 
> >> > The only way to get shorter is to not handle the errors - which is the
> >> > norm in python.
> >> 
> >> It's no different than Perl.
> >
> > Yes, precisely my point. What's yours?
> 
> Then your point is wrong. See <87wu6gafn5.fsf_-_@florent.maison>.
> 
> > Factually incorrect, because you get all that with perl too, and
> > python's default error doesn't give you a meaningful description. See
> > the Carp documentation.
> 
> You are very wrong. You should document yourself before asserting
> blatantly wrong statements.

Right back at you.

> Proof by example:
> 
> ,----[ foo.py ]
> | #! /usr/bin/env python
> | 
> | import sys
> | 
> | def foo_func(arg):
> |     a = int(arg, 10)
> | 
> | 
> | def main():
> |     foo_func("abc")
> |     
> |     sys.exit(0)
> | 
> | if __name__ == "__main__": main()
> `----
> 
> % /tmp/foo.py                                                     flo@florent
> Traceback (most recent call last):
>   File "/tmp/foo.py", line 14, in ?
>     if __name__ == "__main__": main()
>   File "/tmp/foo.py", line 10, in main
>     foo_func("abc")
>   File "/tmp/foo.py", line 6, in foo_func
>     a = int(arg, 10)
> ValueError: invalid literal for int(): abc
> 
> The description is very useful to the programmer. Much more useful than
> a simple segmentation fault (I hope you don't run every binary under gdb
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> with debugging symbols enabled for day-to-day use). It is not very
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Of course not, I can extract a perfectly good stack trace from any
core dump. It is not necessary to run binaries under gdb with
debugging symbols enabled for this to work; why would it be?

> useful to a clueless user, but this is a feature. An exception should
> not be raised to the user.

Well yeah, that's what we're talking about. What are you trying to
say, again?

> As far as Carp is concerned, I tried a Google for "carp python" and the
> first page seems to imply it is a Perl module, so I fail to see how it
> can be relevant to juge the usefulness of "python's default error", as
> you call it.

Duh, because it's how you get perl to do the exact same thing (only
with a description thrown in). So there really is no difference, and
you're talking shit.

-- 
  .''`.  ** Debian GNU/Linux ** | Andrew Suffield
 : :' :  http://www.debian.org/ |
 `. `'                          |
   `-             -><-          |

Attachment: signature.asc
Description: Digital signature


Reply to: