<[EMAIL PROTECTED]> wrote:
>mosscliffe:
>> if key in xrange (60,69) or key == 3:
>I keep seeing again and again code like this, mostly from people not
>much expert of Python, but the PEP 260 shows the fast in was removed,
>so it's O(n).
If you're going to point that out, you should at least also
On May 21, 9:21 am, mosscliffe <[EMAIL PROTECTED]> wrote:
> On 21 May, 15:02, [EMAIL PROTECTED] wrote:
>
> > mosscliffe:
>
> > > if key in xrange (60,69) or key == 3:
>
> > I keep seeing again and again code like this, mostly from people not
> > much expert of Python, but the PEP 260 shows the fast
> > Perhaps you meant that second one to be:
> > (key, mydict[key] for key in mydict if key in xrange(60, 69) or key ==
> > 3)
> >
> Clearly not! Its called *list*-comprehension, not tuple-comprehension. ;)
With () instead of [], it is a generator expression.
http://docs.python.org/ref/genexpr.html
Dustan wrote:
(key, mydict[key] for key in mydict if key in xrange(60, 69) or key == 3]
> File "", line 1
> (key, mydict[key] for key in mydict if key in xrange(60, 69) or
> key == 3]
> ^
> SyntaxError: invalid syntax
>
> Perhaps you meant that secon
On 21 May, 15:02, [EMAIL PROTECTED] wrote:
> mosscliffe:
>
> > if key in xrange (60,69) or key == 3:
>
> I keep seeing again and again code like this, mostly from people not
> much expert of Python, but the PEP 260 shows the fast in was removed,
> so it's O(n). Maybe removing the fast __contains__
On 21 May, 14:13, Larry Bates <[EMAIL PROTECTED]> wrote:
> mosscliffe wrote:
> > I keep seeing examples of statements where it seems conditionals are
> > appended to a for statement, but I do not understand them.
>
> > I would like to use one in the following scenario.
>
> > I have a dictionary of
mosscliffe:
> if key in xrange (60,69) or key == 3:
I keep seeing again and again code like this, mostly from people not
much expert of Python, but the PEP 260 shows the fast in was removed,
so it's O(n). Maybe removing the fast __contains__ was bad for
necomers (or just the casual Python users, t
mosscliffe wrote:
> I keep seeing examples of statements where it seems conditionals are
> appended to a for statement, but I do not understand them.
>
> I would like to use one in the following scenario.
>
> I have a dictionary of
>
> mydict = { 1: 500, 2:700, 3: 800, 60: 456, 62: 543, 58: 6789
On May 21, 7:22 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> On 21 May 2007 05:10:46 -0700, mosscliffe <[EMAIL PROTECTED]> wrote:
>
>
>
> >I keep seeing examples of statements where it seems conditionals are
> >appended to a for statement, but I do not understand them.
>
> >I would like to
On May 21, 7:22 am, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> On 21 May 2007 05:10:46 -0700, mosscliffe <[EMAIL PROTECTED]> wrote:
>
>
>
> >I keep seeing examples of statements where it seems conditionals are
> >appended to a for statement, but I do not understand them.
>
> >I would like to
On 21 May 2007 05:10:46 -0700, mosscliffe <[EMAIL PROTECTED]> wrote:
>I keep seeing examples of statements where it seems conditionals are
>appended to a for statement, but I do not understand them.
>
>I would like to use one in the following scenario.
>
>I have a dictionary of
>
>mydict = { 1: 500
I keep seeing examples of statements where it seems conditionals are
appended to a for statement, but I do not understand them.
I would like to use one in the following scenario.
I have a dictionary of
mydict = { 1: 500, 2:700, 3: 800, 60: 456, 62: 543, 58: 6789}
for key in mydict:
if key
12 matches
Mail list logo