Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8420
| From | Ben Finney <ben+python@benfinney.id.au> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: those darn exceptions |
| References | <itot0b022i@news4.newsguy.com> <96gb36Fc65U1@mid.individual.net> <iu00uh2dhg@news3.newsguy.com> <96itucFadiU1@mid.individual.net> <iu2kif0coj@news4.newsguy.com> |
| Date | 2011-06-25 10:25 +1000 |
| Message-ID | <87d3i2oiyo.fsf@benfinney.id.au> (permalink) |
| Organization | Unlimited download news at news.astraweb.com |
Chris Torek <nospam@torek.net> writes:
> But again, this is why I would like to have the ability to use some
> sort of automated tool, where one can point at any given line of
> code and ask: "what exceptions do you, my faithful tool, believe
> can be raised as a consequence of this line of code?"
“Why, any exception at all”.
> If you point it at the call to main():
>
> if __name__ == '__main__':
> main()
>
> then you are likely to get a useless answer ("why, any exception
> at all"); but if you point it at a call to os.read(), then you get
> one that is useful -- and tells you (or me) about the OverflowError.
No. The answer is *still* “why, any exception at all”. The name
‘os.read’ could be re-bound at run-time to any object at all, so a code
checker that you “point at any given line of code” can't know what the
name will be bound to when that line gets executed.
> If you point it at a call to len(x), then the tool tells you what
> it knows about type(x) and x.__len__.
Which information, before the code is executed, isn't determined.
--
\ “The cost of education is trivial compared to the cost of |
`\ ignorance.” —Thomas Jefferson |
_o__) |
Ben Finney
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
those darn exceptions Chris Torek <nospam@torek.net> - 2011-06-21 01:43 +0000
Re: those darn exceptions Chris Angelico <rosuav@gmail.com> - 2011-06-21 13:19 +1000
Re: those darn exceptions Chris Torek <nospam@torek.net> - 2011-06-21 04:40 +0000
Re: those darn exceptions Ben Finney <ben+python@benfinney.id.au> - 2011-06-21 14:04 +1000
Re: those darn exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-21 09:49 +0000
Re: those darn exceptions Chris Torek <nospam@torek.net> - 2011-06-21 21:51 +0000
Re: those darn exceptions John Nagle <nagle@animats.com> - 2011-06-27 11:52 -0700
Re: those darn exceptions Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-06-23 20:16 +1200
Re: those darn exceptions Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-06-23 18:40 +1000
Re: those darn exceptions Chris Torek <nospam@torek.net> - 2011-06-23 18:33 +0000
Re: those darn exceptions Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-06-24 19:50 +1200
Re: those darn exceptions Chris Torek <nospam@torek.net> - 2011-06-24 18:21 +0000
Re: those darn exceptions Ben Finney <ben+python@benfinney.id.au> - 2011-06-25 10:25 +1000
Re: those darn exceptions Chris Angelico <rosuav@gmail.com> - 2011-06-25 13:55 +1000
Re: those darn exceptions steve+comp.lang.python@pearwood.info - 2011-06-26 00:28 +1000
Re: those darn exceptions Chris Angelico <rosuav@gmail.com> - 2011-06-26 01:52 +1000
csiph-web