Re: builtin set literal

2007-02-21 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > Steven Bethard: >> take a look at the current state of tuples: >>1, 2 >>1, >>() > > That's not a good situation. I presume the situation/syntax of tuples > in Python 2.x can't be improved. But can it be improved for Py 3.0? I'm not really losing any sleep ov

Re: builtin set literal

2007-02-21 Thread bearophileHUGS
Steven Bethard: > take a look at the current state of tuples: >1, 2 >1, >() That's not a good situation. I presume the situation/syntax of tuples in Python 2.x can't be improved. But can it be improved for Py 3.0? Notes: - I think in Matlab a single element is seen as the same thing as

Re: builtin set literal

2007-02-21 Thread Dave Opstad
In article <[EMAIL PROTECTED]>, Paul Rubin wrote: > [...] However, Python seems to use the -ed suffix for the > non-mutating versions of these functions, e.g. sorted(list) instead > of the mutating list.sort(). I've found this to be useful in my own Python librari

Re: builtin set literal

2007-02-20 Thread Steven Bethard
Steven Bethard: > While Python 3.0 is not afraid to break backwards > compatibility, it tries to do so only when there's a very substantial > advantage. [EMAIL PROTECTED] wrote: > I understand, but this means starting already to put (tiny) > inconsistencies into Python 3.0... Well, there's goi

Re: builtin set literal

2007-02-20 Thread Alan Isaac
Paul Rubin wrote: > There's even a sentiment in some pythonistas to get rid of the [] and {} > notations for lists and dicts, using list((1,2,3)) and dict((1,2),(3,4)) > for [1,2,3] and {1:2, 3:4} respectively. Well then for consistency they must want tuple((1,2,3)) for (1,2,3). Oh oh, that must

Re: builtin set literal

2007-02-20 Thread Paul Rubin
[EMAIL PROTECTED] writes: > Unrelated: Ruby and Lisp use ? and ! at the end of the function/method > names to denote a predicate or a function that mutates in place (With > them the list.sort() may be called list.sort!() ). Using Python I > usually put an Q at the end of the name for this purpose.

Re: builtin set literal

2007-02-20 Thread bearophileHUGS
Steven Bethard: > While Python 3.0 is not afraid to break backwards > compatibility, it tries to do so only when there's a very substantial > advantage. I understand, but this means starting already to put (tiny) inconsistencies into Python 3.0... Unrelated: Ruby and Lisp use ? and ! at the end o

Re: builtin set literal

2007-02-20 Thread zefciu
Paul Rubin wrote: > There's even a sentiment in some pythonistas to get rid of the [] and {} > notations for lists and dicts, using list((1,2,3)) and dict((1,2),(3,4)) > for [1,2,3] and {1:2, 3:4} respectively. Wow. This makes Python twice more LISPy, than <1, 2, 3> and {-} make it C-ish and Perl

Re: builtin set literal

2007-02-17 Thread Hendrik van Rooyen
"Schüle Daniel" <[EMAIL PROTECTED]> wrote: > > > {:} for empty dict and {} for empty set don't look too much atrocious > > to me. > > this looks consistent to me I disagree. What would be consistent would be to follow the pattern, and use a different set of delimiters. Python uses () for tuple

Re: builtin set literal

2007-02-17 Thread Hendrik van Rooyen
"Paul Rubin" wrote: > Steven Bethard <[EMAIL PROTECTED]> writes: > > Yes, a lot of people liked this approach, but it was rejected due to > > gratuitous breakage. While Python 3.0 is not afraid to break backwards > > compatibility, it tries to do so only when there's

Re: builtin set literal

2007-02-16 Thread Paul Rubin
Paul Rubin writes: > notations for lists and dicts, using list((1,2,3)) and dict((1,2),(3,4)) > for [1,2,3] and {1:2, 3:4} respectively. Actually that would be dict(((1,2), (3,4))), of course. -- http://mail.python.org/mailman/listinfo/python-list

Re: builtin set literal

2007-02-16 Thread Paul Rubin
Steven Bethard <[EMAIL PROTECTED]> writes: > Yes, a lot of people liked this approach, but it was rejected due to > gratuitous breakage. While Python 3.0 is not afraid to break backwards > compatibility, it tries to do so only when there's a very substantial > advantage. I guess enough people felt

Re: builtin set literal

2007-02-16 Thread Steven Bethard
Schüle Daniel wrote: >> {:} for empty dict and {} for empty set don't look too much atrocious >> to me. > > this looks consistent to me Yes, a lot of people liked this approach, but it was rejected due to gratuitous breakage. While Python 3.0 is not afraid to break backwards compatibility, it t

Re: builtin set literal

2007-02-16 Thread Schüle Daniel
> {:} for empty dict and {} for empty set don't look too much atrocious > to me. this looks consistent to me -- http://mail.python.org/mailman/listinfo/python-list

Re: builtin set literal

2007-02-16 Thread bearophileHUGS
Raymond Hettinger: > One of the reasons for the > rejection was that the small benefit of a literal notion was more than > offset by the attendant need for syntactical atrocities like those > listed above. {:} for empty dict and {} for empty set don't look too much atrocious to me. Note: the lan

Re: builtin set literal

2007-02-15 Thread Raymond Hettinger
>> What about "{,}"? For consistency "(,)" and "[,]" might >> also have to be permissible, and maybe even "{:}" for an >> empty dict. The notion of a set literal was rejected in PEP 218, http://www.python.org/dev/peps/pep-0218/ . One of the reasons for the rejection was that the small benefit of a

Re: builtin set literal

2007-02-15 Thread MRAB
On Feb 15, 4:12 pm, Schüle Daniel <[EMAIL PROTECTED]> wrote: > [...] > > >>> In Python 3.0, this looks like:: > > >>> s = {1,2,3} > > >> jepp, that looks not bad .. as in a mathe book. > >> the only disadvantage I see, that one may confuse it with a dict. > > > Perhaps with a very cursory inspe

Re: builtin set literal

2007-02-15 Thread Schüle Daniel
[...] >>> In Python 3.0, this looks like:: >>> >>> s = {1,2,3} >> >> jepp, that looks not bad .. as in a mathe book. >> the only disadvantage I see, that one may confuse it with a dict. > > Perhaps with a very cursory inspection. But the lack of any ':' > characters is a pretty quick clue-in

Re: builtin set literal

2007-02-15 Thread Steven Bethard
Schüle Daniel wrote: > Steven Bethard schrieb: >> Schüle Daniel wrote: >>> it would be nice feature to have builtin literal for set type >>> maybe in P3 .. what about? >>> s = <1,2,3> >> >> In Python 3.0, this looks like:: >> >> s = {1,2,3} > > jepp, that looks not bad .. as in a mathe book. >

Re: builtin set literal

2007-02-15 Thread Schüle Daniel
Steven Bethard schrieb: > Schüle Daniel wrote: >> Hello, >> >> lst = list((1,2,3)) >> lst = [1,2,3] >> >> t = tupel((1,2,3)) >> t = (1,2,3) >> >> s = set((1,2,3)) >> s = ... >> >> it would be nice feature to have builtin literal for set type >> maybe in P3 .. what about? >> s = <1,2,3> > > In Pyth

Re: builtin set literal

2007-02-15 Thread Schüle Daniel
faulkner schrieb: > On Feb 14, 11:55 am, Schüle Daniel <[EMAIL PROTECTED]> wrote: >> Hello, >> >> lst = list((1,2,3)) >> lst = [1,2,3] >> >> t = tupel((1,2,3)) >> t = (1,2,3) >> >> s = set((1,2,3)) >> s = ... >> >> it would be nice feature to have builtin literal for set type >> maybe in P3 .. what

Re: builtin set literal

2007-02-15 Thread Steven Bethard
Schüle Daniel wrote: > Hello, > > lst = list((1,2,3)) > lst = [1,2,3] > > t = tupel((1,2,3)) > t = (1,2,3) > > s = set((1,2,3)) > s = ... > > it would be nice feature to have builtin literal for set type > maybe in P3 .. what about? > s = <1,2,3> In Python 3.0, this looks like:: s = {1,2

Re: builtin set literal

2007-02-14 Thread faulkner
On Feb 14, 11:55 am, Schüle Daniel <[EMAIL PROTECTED]> wrote: > Hello, > > lst = list((1,2,3)) > lst = [1,2,3] > > t = tupel((1,2,3)) > t = (1,2,3) > > s = set((1,2,3)) > s = ... > > it would be nice feature to have builtin literal for set type > maybe in P3 .. what about? > s = <1,2,3> > > Regards

builtin set literal

2007-02-14 Thread Schüle Daniel
Hello, lst = list((1,2,3)) lst = [1,2,3] t = tupel((1,2,3)) t = (1,2,3) s = set((1,2,3)) s = ... it would be nice feature to have builtin literal for set type maybe in P3 .. what about? s = <1,2,3> Regards, Daniel -- http://mail.python.org/mailman/listinfo/python-list