|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
what is the easiest way for a dict like in python?
are there hash tables? |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On May 26, 2008, at 7:44 PM, notnorwegian@yahoo.se wrote: > what is the easiest way for a dict like in python? > > are there hash tables? > > gen install orderedhash a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
From: notnorwegian@yahoo.se [mailto:notnorwegian@yahoo.se]=20
# what is the easiest way for a dict like in python? # are there hash tables? yes. qri Hash=20 or=20 http://www.ruby-doc.org/core/classes/Hash.html in ruby1.9, insertion order is preserved. kind regards -botp |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 ara.t.howard wrote: | gen install orderedhash ~ ^^^ Should be 'gem'. ![]() - -- Phillip Gawlowski Twitter: twitter.com/cynicalryan Blog: http://justarubyist.blogspot.com Make sure input cannot violate the limits of the program. ~ - The Elements of Programming Style (Kernighan & Plaugher) -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkg7ayYACgkQbtAgaoJTgL+pgQCfRBr4qrgVY3 jS5xzi9441zE57 ZX4AoKN2xXGZBx/jv2et/p+Hz4XE9VDv =chyJ -----END PGP SIGNATURE----- |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
unknown wrote:
> what is the easiest way for a dict like in python? > > are there hash tables? The easiest solution is to use a hash, which is built into the language. This is assuming the order in which the entries are stored within the hash is unimportant. In very many cases this is true. dict = {} dict["aardvark"] = "a" dict["badger"] = "b" p dict You don't have to use strings for keys and values; you can use just about anything you want. -- Posted via http://www.ruby-forum.com/. |
|
![]() |
| Outils de la discussion | |
|
|