On Oct 31, 4:27 pm, Lawrence D'Oliveiro wrote:
> In message
> <687bcb76-0093-4d68-ba56-0390a3e1e...@30g2000yql.googlegroups.com>,
>
> cbr...@cbrownsystems.com wrote:
> > I should note that efficiency is not an issue to me here; this is for
> > when you have, say, a list user_options of at most aro
In message
<687bcb76-0093-4d68-ba56-0390a3e1e...@30g2000yql.googlegroups.com>,
cbr...@cbrownsystems.com wrote:
> I should note that efficiency is not an issue to me here; this is for
> when you have, say, a list user_options of at most around 15 options
> or so, and you want to perform some actio
In message <4cca5aaf$0$1600$742ec...@news.sonic.net>, John Nagle wrote:
> This is cheaper than intersection ...
All together now:
“PREMATURE OPTIMIZATION IS THE ROOT OF ALL EVIL!”
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 29, 2:43 am, Steven D'Aprano wrote:
> On Thu, 28 Oct 2010 09:16:42 -0700, cbr...@cbrownsystems.com wrote:
> > It's clear but tedious to write:
>
> > if 'monday" in days_off or "tuesday" in days_off:
> > doSomething
>
> > I currently am tending to write:
>
> > if any([d for d in ['monday
cbr...@cbrownsystems.com wrote:
> It's clear but tedious to write:
>
> if 'monday" in days_off or "tuesday" in days_off:
>doSomething
>
> I currently am tending to write:
>
> if any([d for d in ['monday', 'tuesday'] if d in days_off]):
>doSomething
>
> Is there a better pythonic idiom
On Thu, 28 Oct 2010 09:16:42 -0700, cbr...@cbrownsystems.com wrote:
> It's clear but tedious to write:
>
> if 'monday" in days_off or "tuesday" in days_off:
> doSomething
>
> I currently am tending to write:
>
> if any([d for d in ['monday', 'tuesday'] if d in days_off]):
> doSomething
Not sure why you use the for-else syntax without a break or continue. And
I'm also not sure on the readability.
-Xav on his Froyo
On 29/10/2010 6:21 PM, "HEK" wrote:
> On Oct 28, 6:16 pm, "cbr...@cbrownsystems.com"
> wrote:
>> It's clear but tedious to write:
>>
>> if 'monday" in days_off or "tu
On Oct 28, 6:16 pm, "cbr...@cbrownsystems.com"
wrote:
> It's clear but tedious to write:
>
> if 'monday" in days_off or "tuesday" in days_off:
> doSomething
>
> I currently am tending to write:
>
> if any([d for d in ['monday', 'tuesday'] if d in days_off]):
> doSomething
>
> Is there a be
On Oct 28, 10:50 pm, Paul Rubin wrote:
> John Nagle writes:
> > d1 = set('monday','tuesday')
> > days_off = set('saturday','sunday')
> > if not d1.isdisjoint(days_off) :...
> > This is cheaper than intersection, since it doesn't have to
> > allocate and construct a set. It just tests
On Oct 28, 11:56 am, Arnaud Delobelle wrote:
> "cbr...@cbrownsystems.com" writes:
> > It's clear but tedious to write:
>
> > if 'monday" in days_off or "tuesday" in days_off:
> > doSomething
>
> > I currently am tending to write:
>
> > if any([d for d in ['monday', 'tuesday'] if d in days_off
On 29 October 2010 15:50, Paul Rubin wrote:
> John Nagle writes:
> >d1 = set('monday','tuesday')
> >days_off = set('saturday','sunday')
> >if not d1.isdisjoint(days_off) :...
> >This is cheaper than intersection, since it doesn't have to
> > allocate and construct a set. It just
John Nagle writes:
>d1 = set('monday','tuesday')
>days_off = set('saturday','sunday')
>if not d1.isdisjoint(days_off) :...
>This is cheaper than intersection, since it doesn't have to
> allocate and construct a set. It just tests whether any element in the
> smaller of the two sets
On 10/28/2010 9:23 AM, John Posner wrote:
On 10/28/2010 12:16 PM, cbr...@cbrownsystems.com wrote:
It's clear but tedious to write:
if 'monday" in days_off or "tuesday" in days_off:
doSomething
I currently am tending to write:
if any([d for d in ['monday', 'tuesday'] if d in days_off]):
doSome
"cbr...@cbrownsystems.com" writes:
> It's clear but tedious to write:
>
> if 'monday" in days_off or "tuesday" in days_off:
> doSomething
>
> I currently am tending to write:
>
> if any([d for d in ['monday', 'tuesday'] if d in days_off]):
> doSomething
>
> Is there a better pythonic idio
On Oct 28, 10:05 am, Chris Rebert wrote:
> On Thu, Oct 28, 2010 at 9:33 AM, cbr...@cbrownsystems.com
>
>
>
> wrote:
> > On Oct 28, 9:23 am, John Posner wrote:
> >> On 10/28/2010 12:16 PM, cbr...@cbrownsystems.com wrote:
>
> >> > It's clear but tedious to write:
>
> >> > if 'monday" in days_off o
On Oct 28, 12:33 pm, "cbr...@cbrownsystems.com"
wrote:
> On Oct 28, 9:23 am, John Posner wrote:
>
>
>
> > On 10/28/2010 12:16 PM, cbr...@cbrownsystems.com wrote:
>
> > > It's clear but tedious to write:
>
> > > if 'monday" in days_off or "tuesday" in days_off:
> > > doSomething
>
> > > I cur
On Thu, Oct 28, 2010 at 9:33 AM, cbr...@cbrownsystems.com
wrote:
> On Oct 28, 9:23 am, John Posner wrote:
>> On 10/28/2010 12:16 PM, cbr...@cbrownsystems.com wrote:
>>
>> > It's clear but tedious to write:
>>
>> > if 'monday" in days_off or "tuesday" in days_off:
>> > doSomething
>>
>> > I c
On Thu, Oct 28, 2010 at 9:16 AM, cbr...@cbrownsystems.com <
cbr...@cbrownsystems.com> wrote:
> It's clear but tedious to write:
>
> if 'monday" in days_off or "tuesday" in days_off:
>doSomething
>
> I currently am tending to write:
>
> if any([d for d in ['monday', 'tuesday'] if d in days_off]
On Oct 28, 9:23 am, John Posner wrote:
> On 10/28/2010 12:16 PM, cbr...@cbrownsystems.com wrote:
>
> > It's clear but tedious to write:
>
> > if 'monday" in days_off or "tuesday" in days_off:
> > doSomething
>
> > I currently am tending to write:
>
> > if any([d for d in ['monday', 'tuesday']
On 10/28/2010 12:16 PM, cbr...@cbrownsystems.com wrote:
It's clear but tedious to write:
if 'monday" in days_off or "tuesday" in days_off:
doSomething
I currently am tending to write:
if any([d for d in ['monday', 'tuesday'] if d in days_off]):
doSomething
Is there a better pythonic
It's clear but tedious to write:
if 'monday" in days_off or "tuesday" in days_off:
doSomething
I currently am tending to write:
if any([d for d in ['monday', 'tuesday'] if d in days_off]):
doSomething
Is there a better pythonic idiom for this situation?
Cheers - Chas
--
http://mail.p
21 matches
Mail list logo