Re: Python 2.7 parser bug on syntax for set literals ?

2010-10-23 Thread Ned Deily
In article , Steve Howe wrote: > The whole point is, is not supposed to be a set; a set literal would > end with "})". As you can see, there is no such construct in the > string. > It's just a dict inside parentheses. Somehow, the parser seems to > think it's a set. >>> type({'', 1}) >>> type(

Re: Python 2.7 parser bug on syntax for set literals ?

2010-10-23 Thread Steve Holden
Geremy and the parser are correct - it *is* a set. It would only be a dict if you changed the comma to a colon. regards Steve On 10/24/2010 1:31 AM, Steve Howe wrote: > Hello Geremy, > > The whole point is, is not supposed to be a set; a set literal would > end with "})". As you can see, there

Re: Python 2.7 parser bug on syntax for set literals ?

2010-10-23 Thread Steve Howe
Ok, forget, I found the problem: bad sleeping. Thanks. -- Howe howest...@gmail.com On Sun, Oct 24, 2010 at 3:31 AM, Steve Howe wrote: > Hello Geremy, > > The whole point is, is not supposed to be a set; a set literal would > end with "})". As you can see, there is no such construct in the > st

Re: Python 2.7 parser bug on syntax for set literals ?

2010-10-23 Thread Steve Howe
Hello Geremy, The whole point is, is not supposed to be a set; a set literal would end with "})". As you can see, there is no such construct in the string. It's just a dict inside parentheses. Somehow, the parser seems to think it's a set. -- Howe howest...@gmail.com On Sun, Oct 24, 2010 at 2:

Re: Python 2.7 parser bug on syntax for set literals ?

2010-10-23 Thread geremy condra
On Sat, Oct 23, 2010 at 9:40 PM, Steve Howe wrote: > Hello, > > This looks like a parser bug, but it's so basic I'm in doubt. Can > anyone confirm ? > import sys sys.version > '2.7.0+ (r27:82500, Sep 15 2010, 18:14:55) \n[GCC 4.4.5]' ({'', 1}.items()) > Traceback (most recent call l

Re: Python 2.7 parser bug on syntax for set literals ?

2010-10-23 Thread Jerry Hill
On Sun, Oct 24, 2010 at 12:40 AM, Steve Howe wrote: > Hello, > > This looks like a parser bug, but it's so basic I'm in doubt. Can > anyone confirm ? > import sys sys.version > '2.7.0+ (r27:82500, Sep 15 2010, 18:14:55) \n[GCC 4.4.5]' ({'', 1}.items()) > Traceback (most recent call

Python 2.7 parser bug on syntax for set literals ?

2010-10-23 Thread Steve Howe
Hello, This looks like a parser bug, but it's so basic I'm in doubt. Can anyone confirm ? >>> import sys >>> sys.version '2.7.0+ (r27:82500, Sep 15 2010, 18:14:55) \n[GCC 4.4.5]' >>> ({'', 1}.items()) Traceback (most recent call last): File "", line 1, in AttributeError: 'set' object has no at

Re: Set literals

2005-03-21 Thread George Sakkis
[EMAIL PROTECTED]> wrote: > +1 from me. > > The other possible meaning for {1,2,3} would be {1:None,2:None,3:None}, > but that is usually meant to be a set anyway (done with a dict). > > So what is this: {1:2, 3, 4 } (apart from "nearly useless") ? Syntax error; you'll have to decide whether you

Re: Set literals

2005-03-21 Thread George Sakkis
"Delaney, Timothy C (Timothy)" <[EMAIL PROTECTED]> wrote: > > How about overloading curly braces for set literals, as in > > > >>>> aSet = {1,2,3} > > > > - It is the standard mathematic set notation. > > - There is no ambiguity or back

Re: Set literals

2005-03-21 Thread simon
+1 from me. The other possible meaning for {1,2,3} would be {1:None,2:None,3:None}, but that is usually meant to be a set anyway (done with a dict). So what is this: {1:2, 3, 4 } (apart from "nearly useless") ? hmmm, thinking a bit more about this, it seems you can build a set from a dict's keys

RE: Set literals

2005-03-21 Thread Delaney, Timothy C (Timothy)
George Sakkis wrote: > How about overloading curly braces for set literals, as in > >>>> aSet = {1,2,3} > > - It is the standard mathematic set notation. > - There is no ambiguity or backwards compatibility problem. > - Sets and dicts are in many respects similar

Re: Set literals

2005-03-21 Thread George Sakkis
> - There is no ambiguity or backwards compatibility problem. ...at least if it wasn't for the empty set.. hmm... -- http://mail.python.org/mailman/listinfo/python-list

Set literals

2005-03-21 Thread George Sakkis
How about overloading curly braces for set literals, as in >>> aSet = {1,2,3} - It is the standard mathematic set notation. - There is no ambiguity or backwards compatibility problem. - Sets and dicts are in many respects similar data structures, so why not share the same delimiter