#python - Mon 30 Apr 2007 between 10:24 and 10:56

NY Lost Funds



inhahei thnik there's a function that does that in te random module
my_hazinhahe: name?
inhaherandom.sample
Dtu3ZOhtlnor you know, you could've just read the random module
my_hazinhahe: thanks, i thought i had RTFM, but i guess i didn't do a good enough job ;)
Dtu3ZOhtln: tried that, didn't seem to work, hehe, for got to add Caffine to the mix ;)
Dtu3ZOhtlnhehe
the-moogDumb Question: What exactly is the difference in a list or tuple when it is defined as follows, consider variables a and b: a=(1,2,3) b=(1,2,3,)
Juhaznone
only case trailing comma does something is that you need it to create a single-element tuple (1,)
(1) is not a tuple
perlygatekeeperdifference between a tuple and an array?
nick PGK
Dtu3ZOhtlnperlygatekeeper, tuples are immutable...not sure if you're definition of "array" is
^ PGK
anyone know why tuples are immutable anyways? easier storage and processing or something?
Juhazprimarily so that they're hashable and can be used as dict keys
Dtu3ZOhtlni've never seen a collection used as a dict key, but i see what you mean
PGKcollection == tuple?
Dtu3ZOhtlni was just generalizing for array-like objects. not sure if python refers to them as collections
PGKok what is a dict then?
anyone have a simple example of a dict, like with comments, here is a real dict
buffipythons implementation of a hashtable
PGKsay "hello" to mr. dict
buffihttp://docs.python.org/tut/node7.html#SECTION007500000000000000000
PGKso .. if I want to change an array I have to build a new one and destroy the old one?
buffithere is no such thing as an array in python
Dtu3ZOhtlnPGK, no, you can build a dict from an iterable
buffithe most common collections are tuples, lists and dicts
Dtu3ZOhtlnPGK, d = dict(iterable_like_a_list)
buffi, i'm aware of that. i was referring to an array as a generalized list/tuple structure
buffiyou cant generalize it like that
since lists are mutable and tuples are not
you can enlarge lists inplace but not tuples
Dtu3ZOhtlnwho says i can't generalize like that? what word exclusively describes both lists and tuples
buffiwhat?
Dtu3ZOhtlnbuffi, i'm aware of that, see not 5 minutes ago
buffiwell, my response was to
<PGK> so .. if I want to change an array I have to build a new one and destroy the old one?
Dtu3ZOhtlnyeah, i didn't realize that until after heh

Page: 4 11 18 25 32 39 46 53 60 67 

IrcArchive

NY Lost Funds