Re: [BangPypers] [X-POST] Fwd: [Ilugc] SQL Injection vulnerability in Ruby on Rails forces websites to close down

2013-01-09 Thread Chintan Dave
It takes a little more than being stupid to break things... Trust me :) On Thu, Jan 10, 2013 at 11:02 AM, Venkatraman S wrote: > FYI: > > -- Forwarded message -- > From: Natarajan V > Date: Thu, Jan 10, 2013 at 10:49 AM > Subject: [Ilugc] SQL Injection vulnerability in Ruby on

[BangPypers] [X-POST] Fwd: [Ilugc] SQL Injection vulnerability in Ruby on Rails forces websites to close down

2013-01-09 Thread Venkatraman S
FYI: -- Forwarded message -- From: Natarajan V Date: Thu, Jan 10, 2013 at 10:49 AM Subject: [Ilugc] SQL Injection vulnerability in Ruby on Rails forces websites to close down To: ILUG-C Hi, A major security vulnerability found in RoR has forced a government website to close do

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread vijay
Thanks Anand. This look good to me. From: Anand Chitipothu To: vijay ; Bangalore Python Users Group - India Sent: Wednesday, 9 January 2013 1:43 PM Subject: Re: [BangPypers] List compression imrpovement On Wed, Jan 9, 2013 at 1:11 PM, vijay wrote: > Hi, >

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread vijay
Yes problem statement is correct. I wanted it to be one line solution so i used list compression. If there is other way to do it in one line other then list compression  that should be fine , but need one line answer for this. From: Jeffrey Jose To: Bangalore

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread L Radhakrishna Rao
First of all,it is list comprehension. Second, i don't know what elegant method you want to look, as list in itself is fast. The only thing which you can look out is TUPLE, which are immutable list. ___ BangPypers mailing list BangPypers@python.org http:/

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread Noufal Ibrahim
Jeffrey Jose writes: > On Wed, Jan 9, 2013 at 1:43 PM, Anand Chitipothu wrote: > >> [[x for x in a if x%i == 0] for i in [2, 3]] > > > oh thats smart. Yup. Very. [...] -- Cordially, Noufal http://nibrahim.net.in ___ BangPypers mailing list BangPyp

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread ragsagar
On Wed, Jan 9, 2013 at 1:11 PM, vijay wrote: > 2) [y for y in a if bool(y%2==0)],[y for y in a if bool(y%3==0)] You don't have to do if bool(y%2==0), just if y % 2 == 0 is enough. -- blog : ragsagar.wordpress.com mail id : python -c "print '@'.join(['ragsagar','.'.join([x for x in ['gmail','c

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread Noufal Ibrahim
vijay writes: > Hi, >    I want to know if there is any other better way for improving below > list compression. I have to use list compression only to achieve it. > >    say i have list   a=[1, 4, 9, 12, 15, 21] expected result (4, 12), > (9, 12, 15, 21) It's not clear how the first becomes the

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread Jeffrey Jose
On Wed, Jan 9, 2013 at 1:43 PM, Anand Chitipothu wrote: > [[x for x in a if x%i == 0] for i in [2, 3]] oh thats smart. ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread Anand Chitipothu
On Wed, Jan 9, 2013 at 1:11 PM, vijay wrote: > Hi, >I want to know if there is any other better way for improving below list > compression. I have to use list compression only to achieve it. > >say i have list a=[1, 4, 9, 12, 15, 21] expected result (4, 12), (9, 12, > 15, 21) > > few

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread Jeffrey Jose
Your #2 isnt a *one-line solution. *Its multple statements joined as one. If that works, here's an improvement. >>> tuple(x for x in a if not x%2), tuple(x for x in a if not x%3) ((4, 12), (9, 12, 15, 21)) -jeff On Wed, Jan 9, 2013 at 1:11 PM, vijay wrote: > Hi, >I want to know if there i

Re: [BangPypers] List compression improvement

2013-01-09 Thread Rag Sagar.V
On Wed, Jan 9, 2013 at 1:20 PM, vijay wrote:   2) [y for y in a if bool(y%2==0)],[y for y in a if bool(y%3==0)] You don't have to do `if bool(y%2 == 0)` , just `if y % 2 == 0` is enough ___ BangPypers mailing list BangPypers@python.org http://mail

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread Gora Mohanty
On 9 January 2013 13:25, vijay wrote: > i want to use only list compression to get solution like the way you see i > share solutions. > Basically one line solution . Do you mean "list comprehension"? Even so, it is not clear how the resulting list is to be derived from the original. Rather than

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread Kushal Das
On Wed, Jan 9, 2013 at 1:25 PM, vijay wrote: > i want to use only list compression to get solution like the way you see i > share solutions. > Basically one line solution . > Start reading from here. http://www.catb.org/esr/faqs/smart-questions.html Kushal -- http://fedoraproject.org http://k

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread Jeffrey Jose
Let me guess. You want the first tuple with elements that are divisible by 2 and second divisible by 3. Beats me still as to why you decided to call it "compression" >From your second email it seems like you're after list *comprehension*. On Wed, Jan 9, 2013 at 1:20 PM, Gora Mohanty wrote: >

Re: [BangPypers] List compression imrpovement

2013-01-09 Thread Guruprasad
Hi Vijay, On Wed, Jan 9, 2013 at 1:25 PM, vijay wrote: > i want to use only list compression to get solution like the way you see i > share solutions. > Basically one line solution . I think you are referring to list comprehension here. >>I want to know if there is any other better way for