[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: A few minutes from the ILUGC meet - 23rd Dec, 2000



hi,

>>>>> "Raja" == Raja Subramanian <rsubr@xxxxxxxxxxxx> writes:

    Raja> I've already posted this message once, but it has not
    Raja> appeared on the list.  This is the second time, so my

Well, it didnt show up because you posted it from an address that is
not subscribed to ilugc.  If you want to send messages from other
addresses you can subscribe those addresses and then set them on
vacation.

    Raja> Suraj.co.in wrote (suraj@xxxxxxxxxxxxxx):
    >>  There is another data type called 'dictionary'.
    Raja> [snip]
    >> But the key can be anything, an object, a list, a class, even a
    >> function! the dictionary can be constructed as follows:
    >> 

    Raja> Well, the key can be anything as long as it's
    Raja> immutable. Numbers, strings, tuples, functions, classes and
    Raja> instances are immutable, but not lists. So you *cannot* use
    Raja> lists as dictionary indices.

    Raja> eg.  x = {} # Create an empty dictionary x[["ham"]] = "spam"
    Raja> # Try using a list as a key ....snip....  TypeError:
    Raja> unhashable type
          ^^^^^^^^^^^^^^^

Well, I must own up a bit of responsibility here.  I dont think I was
clear enough about this during the talk.  However, IMHO you are not
entirely correct.  An object must have an "immutable hash".  The
object itself need not be immutable.  A class instance is certainly
not "immutable"!  Here is a snippet from the reference manual:

  Dictionaries

   These represent finite sets of objects indexed by nearly arbitrary
   values. The only types of values not acceptable as keys are values
   containing lists or dictionaries or other mutable types that are
   compared by value rather than by object identity, the reason being
   that the efficient implementation of dictionaries requires a key's
   hash value to remain constant. Numeric types used for keys obey the
   normal rules for numeric comparison: if two numbers compare equal
   (e.g., 1 and 1.0) then they can be used interchangeably to index
   the same dictionary entry.


And here is some clarification on "mutability" from the reference
manual:

    "...The value of some objects can change. Objects whose value can
    change are said to be mutable; objects whose value is unchangeable
    once they are created are called immutable. (The value of an
    immutable container object that contains a reference to a mutable
    object can change when the latter's value is changed; however the
    container is still considered immutable, because the collection of
    objects it contains cannot be changed. So, immutability is not
    strictly the same as having an unchangeable value, it is more
    subtle.) An object's mutability is determined by its type; for
    instance, numbers, strings and tuples are immutable, while
    dictionaries and lists are mutable."

    Raja> An interesting note, the parameter passing mechanism is very
    Raja> similar to tuple assignment. This is also how keyword args
    Raja> work, eg. the Tcl interface Tkinter depends heavily on this
    Raja> feature - eg. button = Tkinter.Button(text = "Quit", command
    Raja> = sys.exit) Sorry that I can't point to some literature that
    Raja> explains this in depth.

I thought that the tutorial deals with this pretty well.  Or I am I
missing something??

    Raja> I also have some comments about the voting business... but
    Raja> since my involvement is little, I don't think I have much
    Raja> say. Still, I prefer solution 5, running the slashdot style
    Raja> "web" subscription. Seems to me that in the long run this
    Raja> would be the ideal solution. Ofcourse, machine and security,
    Raja> restrictions may not allow this at the present... but it's
    Raja> probably a good idea to keep this in sight on the long range
    Raja> radar.

Yeah, this was discussed but we felt that this was not worth it as of
now and involved too many complications.

    Raja> Btw, I'm comming home to India this week - I would be in
    Raja> Madras for a short time only :( Anyway I'll be armed with a
    Raja> good list of sw to give away (latest and greatest
    Raja> debian/redhat/freebsd & win32 python, cygnus win32 tools

Thanks a ton. :)  Have a nice time.  

Suraj, thanks again.  Nice job.  The web page looks nice - neat logo!
:)

prabhu
--
Seasons Greetings and Merry Xmas!
---
Visit our home page at: www.chennailug.org
Send e-mail to 'ilugc-request@xxxxxxxxxxxxxxxxxx' with 'unsubscribe' 
in either the subject or the body to unsubscribe from this list.