Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #25726 > unrolled thread

Re: Basic question about speed/coding style/memory

Started byAndrew Berg <bahamutzero8825@gmail.com>
First post2012-07-21 03:02 -0500
Last post2012-07-21 03:02 -0500
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Basic question about speed/coding style/memory Andrew Berg <bahamutzero8825@gmail.com> - 2012-07-21 03:02 -0500

#25726 — Re: Basic question about speed/coding style/memory

FromAndrew Berg <bahamutzero8825@gmail.com>
Date2012-07-21 03:02 -0500
SubjectRe: Basic question about speed/coding style/memory
Message-ID<mailman.2365.1342857760.4697.python-list@python.org>
On 7/21/2012 2:33 AM, Jan Riechers wrote:
> Block
> ...
> versus this block:
> ...
> Now, very briefly, what is the better way to proceed in terms of 
> execution speed, readability, coding style?
Using if/else is the most readable in the general sense. Using return
(or break or continue as applicable) in this manner would indicate (at
least to me) that it's an exceptional or otherwise special case and that
the function can't do what it's supposed to. In that case, I would try
to catch an exception rather than use if/else whenever possible. I
highly doubt there is a significant performance difference between them.
-- 
CPython 3.3.0b1 | Windows NT 6.1.7601.17803

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web