Re: what is the difference between the two kinds of brackets?

2007-10-20 Thread Steve Lamb
On 2007-10-21, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> A note on terminology: the things inside curly brackets {} are called 
> dictionaries, or dicts, not directories. And the things you use to store 
> data in dictionaries are called keys, not indexes:

Thanks for catching that.  Kids, don't late night post while waiting for
the other computer to do its thing.

-- 
 Steve C. Lamb | But who decides what they dream?
   PGP Key: 1FC01004   |   And dream I do...  
---+-

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what is the difference between the two kinds of brackets?

2007-10-20 Thread Steve Lamb
On 2007-10-20, James Stroud <[EMAIL PROTECTED]> wrote:
>The long of it is that there are deep computer-science 
> issues that distinguish the two and the differences become more 
> important the more you know (presumably). However, I have been 
> programming this language for 5 years, and I still can't figure out the 
> necessity for having both. I have heard all of the arguments, however 
> but none are terribly pursuasive.

The quick answer is that tuples can be indexes into directories while
lists cannot.  This doesn't seem like that big of a deal until you realize it
allows you to group related but distict bits of data together to form an index
while retaining their individual identity.  A simplistic example would be if
you had a map with x,y coordinates and you wanted to place items on that map
at their location.

[EMAIL PROTECTED]:~} python
Python 2.4.4 (#2, Aug 16 2007, 02:03:40) 
[GCC 4.1.3 20070812 (prerelease) (Debian 4.1.2-15)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 1
>>> y = 1
>>> coord = (x, y)
>>> map = {}
>>> map[coord] = "Something at x%s, y%s" % coord
>>> map
{(1, 1): 'Something at x1, y1'}
>>> map[(1,1)]
'Something at x1, y1'
>>> if map.has_key(coord):
... print "Found it!"
... 
>>> if map.has_key((1,1)):
... print "Found it!"
... 
Found it!
>>> for loc in map:
... print "X: %s, Y: %s - %s" % (loc[0], loc[1], map[loc])
... 
X: 1, Y: 1 - Something at x1, y1

The lists cannot be indexes to directories because they are mutable.  
[1. 1] might not be [1, 1] the next time you look for it.  (1, 1) always will.  

-- 
 Steve C. Lamb | But who decides what they dream?
   PGP Key: 1FC01004   |   And dream I do...  
---+-

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: why doesn't have this list a "reply-to" ?

2007-10-16 Thread Steve Lamb
On 2007-10-17, Byung-Hee HWANG <[EMAIL PROTECTED]> wrote:
> Just click "Ctrl-L", then you can reply to lists directly if you use
> good mailer like mutt or thunderbird or evolution ;; 

Thunderbird only if it has the list-reply patch, has either enigmail or
mhengy installed and has the reply-to-list addon installed.  Otherwise, no,
Thunderbird still, years later, lacks that feature.  Part of the reason why I
am test driving gmane in slrn right now.  :)

-- 
 Steve C. Lamb | But who decides what they dream?
   PGP Key: 1FC01004   |   And dream I do...  
---+-

-- 
http://mail.python.org/mailman/listinfo/python-list