Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > very Very VERY dumb Question About The new Set( ) 's

Reply
Thread Tools

very Very VERY dumb Question About The new Set( ) 's

 
 
Raymond Arthur St. Marie II of III
Guest
Posts: n/a
 
      07-23-2003
very Very VERY dumb ? about the new Set( ) 's

Please be kind and read this like you know I've been up 33-34 hours reading
PEP's but...

Doc\ref 2.6 Delimiters show's three unused characters "@ $ ?".
@ sort of looks like and sort of sounds like a set an
$ well sort of obvious.
I can imagine that the $ would be confused for money and @ is ugly.

You folks have prob'ly been all over this.
Even thou I've been using Python since 1.4, I only joined the comp.lang.python
a couple weeks ago so I don't know the flame wars over the Set implimentation.

Ray St. Marie --- Afraid to sign his name to this one
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Alan Gauld
Guest
Posts: n/a
 
      07-24-2003
On 23 Jul 2003 18:47:32 GMT, (E-Mail Removed)orespam (Raymond
Arthur St. Marie II of III ) wrote:

> Doc\ref 2.6 Delimiters show's three unused characters "@ $ ?".
> @ sort of looks like and sort of sounds like a set an
> $ well sort of obvious.
> I can imagine that the $ would be confused for money and @ is ugly.


Since I detest any thought of prefix symbols to indicate type(as
per Perl etc) but have no visibility of these debates, I'll throw
in my suggestion and done a flameproof suit!

Since both dictionaries and Sets require unique members/keys,
why not use the dictionary braces but without the key/value
syntax. So:

mySet = {1,2,3,4}

Which is illegal for a dictionary but would be OK for a Set.
It also just happens to be the same delimiters used in math
for sets...

Just a thought before I go to bed!

Alan G.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld
 
Reply With Quote
 
 
 
 
Carl Banks
Guest
Posts: n/a
 
      07-24-2003
Alan Gauld wrote:
> On 23 Jul 2003 18:47:32 GMT, (E-Mail Removed)orespam (Raymond
> Arthur St. Marie II of III ) wrote:
>
>> Doc\ref 2.6 Delimiters show's three unused characters "@ $ ?".
>> @ sort of looks like and sort of sounds like a set an
>> $ well sort of obvious.
>> I can imagine that the $ would be confused for money and @ is ugly.

>
> Since I detest any thought of prefix symbols to indicate type(as
> per Perl etc) but have no visibility of these debates, I'll throw
> in my suggestion and done a flameproof suit!
>
> Since both dictionaries and Sets require unique members/keys,
> why not use the dictionary braces but without the key/value
> syntax. So:
>
> mySet = {1,2,3,4}
>
> Which is illegal for a dictionary but would be OK for a Set.
> It also just happens to be the same delimiters used in math
> for sets...
>
> Just a thought before I go to bed!



+1 if Python's parser could handle it (which seems dubious).


--
CARL BANKS
 
Reply With Quote
 
Inyeol Lee
Guest
Posts: n/a
 
      07-24-2003
On Thu, Jul 24, 2003 at 10:31:11PM +0000, Alan Gauld wrote:
[...]
> Since both dictionaries and Sets require unique members/keys,
> why not use the dictionary braces but without the key/value
> syntax. So:
>
> mySet = {1,2,3,4}
>
> Which is illegal for a dictionary but would be OK for a Set.
> It also just happens to be the same delimiters used in math
> for sets...


See PEP 218. It describes a long term plan to make set builtin type,
including syntax for constant set {1,2,3,4} and empty set {-}.

Inyeol

 
Reply With Quote
 
Raymond Hettinger
Guest
Posts: n/a
 
      07-27-2003
> > Since both dictionaries and Sets require unique members/keys,
> > why not use the dictionary braces but without the key/value
> > syntax. So:
> >
> > mySet = {1,2,3,4}
> >
> > Which is illegal for a dictionary but would be OK for a Set.
> > It also just happens to be the same delimiters used in math
> > for sets...


>
>
> +1 if Python's parser could handle it (which seems dubious).



FWIW, I think the easiest and most readable syntax is:

mySet = set(1, 2, 3, 4)

BTW, this is a bit reminiscent of the discussion about a syntax
for entering fixed decimals. After much discussion, someone
realized the obvious and noted that real programs mostly
take in their fixed point data from external sources and would
rarely appear as a constant in a program; hence, there was no
need for a special syntax -- just Decimal(data) would do the
trick. (Think about a program like Quicken for checkbook
accounting -- none of the check/deposit amounts are known
in advance so the program is unlikely to contain any fixed
decimal constants except zero and $0.01).


Raymond Hettinger



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dumb, Dumb Vista Au79 Computer Support 4 02-11-2007 03:40 PM
Very dumb question Laszlo Zsolt Nagy Python 4 10-12-2005 03:03 PM
Re: Very dumb question Laszlo Zsolt Nagy Python 1 10-12-2005 02:03 PM
Dumb, dumb dumb Qestion David Napierkowski Digital Photography 6 10-31-2004 11:14 PM
dumb newbie question (or newbie dumb question) Jerry C. Perl Misc 8 11-23-2003 04:11 AM



Advertisments