Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52627
| References | <185a0a88-9515-43e6-ae65-73d86b0299e7@googlegroups.com> |
|---|---|
| Date | 2013-08-17 14:31 +0100 |
| Subject | Re: Check for the type of arguments |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.14.1376746274.23369.python-list@python.org> (permalink) |
On Sat, Aug 17, 2013 at 1:34 PM, Fernando Saldanha <fsaldan1@gmail.com> wrote: > Writing in other languages I usually check the type and values of function arguments. In the Python code examples I have seen this is rarely done. > > Questions: > > 1) Is this because it would be "unpythonic" or just because the examples are not really production code? It's unpythonic. The normal thing to do is simply use the object you're given, and if something goes wrong, the exception will have a full traceback. And if you don't notice that it isn't what you expect, well, it probably didn't matter! ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Check for the type of arguments Fernando Saldanha <fsaldan1@gmail.com> - 2013-08-17 05:34 -0700 Re: Check for the type of arguments Skip Montanaro <skip@pobox.com> - 2013-08-17 07:55 -0500 Re: Check for the type of arguments Chris Angelico <rosuav@gmail.com> - 2013-08-17 14:31 +0100 Re: Check for the type of arguments Joshua Landau <joshua@landau.ws> - 2013-08-17 15:38 +0100 Re: Check for the type of arguments Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-17 15:46 +0000 Re: Check for the type of arguments Fernando Saldanha <fsaldan1@gmail.com> - 2013-08-17 09:00 -0700
csiph-web