[BangPypers] which one is the best pythonic way .

steve steve at lonetwin.net
Tue Feb 9 07:34:16 CET 2010


On 02/09/2010 10:37 AM, Anand Chitipothu wrote:
> On Tue, Feb 9, 2010 at 10:22 AM, Srinivas Reddy Thatiparthy
> [...snip...]
> #1.
>
> You can even remove the square brackets.
>
> sum(i for i in range(1000) if i%3==0 or i%5==0)

Yes, you can but that doesn't necessarily mean it is better. Interestingly, 
something similar was discussed at comp.lang.python:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/7897bf3fd2298332/26247987f84cc484


cheers,
- steve
-- 
random non tech spiel: http://lonetwin.blogspot.com/
tech randomness: http://lonehacks.blogspot.com/
what i'm stumbling into: http://lonetwin.stumbleupon.com/


More information about the BangPypers mailing list