how do i map this?

2006-11-12 Thread ronrsr
I think I am passing the wrong argument to the Print_row routine: Traceback (most recent call last): File index.py, line 91, in ? zhtml.print_row(record) File /usr/www/users/homebase/realprogress/zingers/zhtml.py, line 154, in pri nt_row print tr TypeError: format requires a mapping

Re: how do i map this?

2006-11-12 Thread Ben Finney
ronrsr [EMAIL PROTECTED] writes: #row is a dictionary with keys: zid, keywords, citation, quotation def print_row(row): print tr td class=pad%(keywords)s /td td class=pad%(quotation)s /td td class=pad%(citation)s /td td class=pad

Re: how do i map this?

2006-11-12 Thread John Machin
Ben Finney wrote: ronrsr [EMAIL PROTECTED] writes: #row is a dictionary with keys: zid, keywords, citation, quotation def print_row(row): print tr td class=pad%(keywords)s /td td class=pad%(quotation)s /td td class=pad%(citation)s /td

Re: how do i map this?

2006-11-12 Thread Gabriel G
At Monday 13/11/2006 01:55, John Machin wrote: Ben Finney wrote: ronrsr [EMAIL PROTECTED] writes: #row is a dictionary with keys: zid, keywords, citation, quotation def print_row(row): print tr [...] You're printing a string, and never using that 'row' parameter.

Re: how do i map this?

2006-11-12 Thread John Machin
ronrsr wrote: I think I am passing the wrong argument to the Print_row routine: Well, yes, that is what the error message is telling you. It is also what Fredrik Lundh told you only a couple of hours ago. He also told you what to do to fix it, at a high level. Below is my attempt to explain at

Re: how do i map this?

2006-11-12 Thread Ben Finney
John Machin [EMAIL PROTECTED] writes: Ben Finney wrote: You're printing a string, and never using that 'row' parameter. If that is so, why is he getting that message TypeError: format requires a mapping? No idea. Probably because what the poster showed us is not code that shows the problem

Re: pylint: What's wrong with the builtin map()

2006-10-22 Thread Tuomas
Georg Brandl wrote: Some people think that all occurences of map() must be replaced by list comprehensions. The designer of pylint seems to be one of those. So it seems, but why? Formally spoken we ase using variable 'x' before assigment in the comprehension too. #!/usr/bin/python test

Re: pylint: What's wrong with the builtin map()

2006-10-22 Thread Georg Brandl
Tuomas wrote: #!/usr/bin/python test pydev_0.9.3/../pylint __revision__ = test_mod 0.1 by TV 06/10/22 lst = ['aaa', ' bbb', '\tccc\n'] lst = map(lambda x: x.strip(), lst) result = No config file found, using default configuration * Module test_mod W: 6: Used builtin

pylint: What's wrong with the builtin map()

2006-10-22 Thread Tuomas
#!/usr/bin/python test pydev_0.9.3/../pylint __revision__ = test_mod 0.1 by TV 06/10/22 lst = ['aaa', ' bbb', '\tccc\n'] lst = map(lambda x: x.strip(), lst) result = No config file found, using default configuration * Module test_mod W: 6: Used builtin function 'map' E: 6: Using

Re: pylint: What's wrong with the builtin map()

2006-10-22 Thread Fredrik Lundh
Tuomas wrote: lst = map(lambda x: x.strip(), lst) list comprehensions are more efficient than map/lambda combinations; the above is better written as: lst = [x.strip() for x in lst] in general, map() works best when the callable is an existing function (especially if it's a built

Re: pylint: What's wrong with the builtin map()

2006-10-22 Thread Georg Brandl
Tuomas wrote: Georg Brandl wrote: Some people think that all occurences of map() must be replaced by list comprehensions. The designer of pylint seems to be one of those. So it seems, but why? See Fredrik's post. There's no error in the expression with map(), it's just less effective than

Re: pylint: What's wrong with the builtin map()

2006-10-22 Thread Robert Kern
Tuomas wrote: #!/usr/bin/python test pydev_0.9.3/../pylint __revision__ = test_mod 0.1 by TV 06/10/22 lst = ['aaa', ' bbb', '\tccc\n'] lst = map(lambda x: x.strip(), lst) result = No config file found, using default configuration * Module test_mod W: 6: Used builtin

Re: pyExcelerator question - dates map to floats?

2006-09-10 Thread skip
John Check out my xlrd package. John http://cheeseshop.python.org/pypi/xlrd/0.5.2 ... John, Thank you. I wasn't aware of it. I'd seen mention of pyExcelerator a few times recently. All I need is to read Excel spreadsheets anyway. I will check it out. I'm up for reading a good

Re: pyExcelerator question - dates map to floats?

2006-09-10 Thread skip
John Check out my xlrd package. John http://cheeseshop.python.org/pypi/xlrd/0.5.2 Very nice. Thanks for the pointer. I threw away about 75% of the xls-to-csv converter I wrote using pyExcelerator. And it worked with Python 2.3 without having to comment out all the decorators. Skip --

Re: Map with an extra parameter

2006-09-09 Thread Simon Forman
foo() Bye, bearophile (Not sure if this group likes top or bottom posts, sorry) Thanks for the reply, In the interests of speed my thinking was that using map would move the loop out of Python and into C, is that the case when using list comprehension? I'd always thought it was just

Re: Map with an extra parameter

2006-09-09 Thread Peter Otten
() f.a = a f.b = b return f constants = [1]*6 vars = [1,2,3,4,5,6] objects = map(func,vars,constants) In the real world I need to do this as quick as possible (without resorting to c) and there are several constants. (The constant is only constant to each list so I can't make

pyExcelerator question - dates map to floats?

2006-09-09 Thread skip
I'm experimenting with pyExcelerator and am reading an XLS file which contains dates. In Excel on my Mac they look like 09/13/06. After parsing them out of the .XLS file they are floats, e.g. 38973.0. I assume that's an offset in days. Doing a little date math I come up with a base date of

Re: pyExcelerator question - dates map to floats?

2006-09-09 Thread skip
skip Doing a little date math I come up with a base date of skip approximately (though not quite) 1900-01-01: ... Reading the code in BIFFRecords.py I saw this docstring: This record specifies the base date for displaying date values. All dates are stored as count of

Re: pyExcelerator question - dates map to floats?

2006-09-09 Thread John Machin
[EMAIL PROTECTED] wrote: skip Doing a little date math I come up with a base date of skip approximately (though not quite) 1900-01-01: ... Reading the code in BIFFRecords.py I saw this docstring: This record specifies the base date for displaying date values. All

Map with an extra parameter

2006-09-08 Thread ml1n
return f constants = [1]*6 vars = [1,2,3,4,5,6] objects = map(func,vars,constants) In the real world I need to do this as quick as possible (without resorting to c) and there are several constants. (The constant is only constant to each list so I can't make it a default argument to func.) My

Re: Map with an extra parameter

2006-09-08 Thread bearophileHUGS
This may be what you need: class foo: def __init__(self, a, b): self.a = a self.b = b vars = [1,2,3,4,5,6] objects = [foo(a, 1) for a in vars] Note that in Python the new is expressed wit the () at the end: f = new foo() Bye, bearophile --

Re: Map with an extra parameter

2006-09-08 Thread ml1n
(Not sure if this group likes top or bottom posts, sorry) Thanks for the reply, In the interests of speed my thinking was that using map would move the loop out of Python and into C, is that the case when using list comprehension? I'd always thought it was just syntatic short hand for a Python loop

Re: Map with an extra parameter

2006-09-08 Thread bearophileHUGS
ml1n wrote: In the interests of speed my thinking was that using map would move the loop out of Python and into C, is that the case when using list comprehension? I'd always thought it was just syntatic short hand for a Python loop. In Python the faster things are often the most simple. You

Re: Map with an extra parameter

2006-09-08 Thread Paul Rubin
ml1n [EMAIL PROTECTED] writes: In the interests of speed my thinking was that using map would move the loop out of Python and into C, is that the case when using list comprehension? I'd always thought it was just syntatic short hand for a Python loop. Best to run benchmarks, but I don't

Re: Map with an extra parameter

2006-09-08 Thread ml1n
[EMAIL PROTECTED] wrote: ml1n wrote: In the interests of speed my thinking was that using map would move the loop out of Python and into C, is that the case when using list comprehension? I'd always thought it was just syntatic short hand for a Python loop. In Python the faster things

Re: Map with an extra parameter

2006-09-08 Thread bearophileHUGS
ml1n: Looks like someone already did: http://mail.python.org/pipermail/python-list/2005-January/259870.html Don't belive too much in such general timings. Time your specific code when you think you need a true answer. Timing Python code is very easy and fast, and sometimes results are

Re: Problem of function calls from map()

2006-08-28 Thread Dasn
On Tue, Aug 22, 2006 at 04:50:39PM +0200, Fredrik Lundh wrote: (you cannot really use profile to *benchmark* things written in Python either; the profiler tells you where a given program spends the time, not how fast it is in com- parision with other programs) Thanks for your indication. --

Re: Problem of function calls from map()

2006-08-27 Thread Steve Holden
Fredrik Lundh wrote: Steve Holden wrote: Well I guess if people wanted to argue for keeping the functionals this should be on the list ... who's arguing ? Please note that word if, but you are surely aware that there havebeen suggestions that Python's functional programming aspects

Re: Problem of function calls from map()

2006-08-24 Thread Fredrik Lundh
Steve Holden wrote: Well I guess if people wanted to argue for keeping the functionals this should be on the list ... who's arguing ? is this perhaps a little like the now that we have lexical scoping, the default argument object binding trick is no longer needed myth ? /F --

Re: Problem of function calls from map()

2006-08-23 Thread Steve Holden
that although split() *is* faster than split(\t), it's fractional, rather than the OP's four times faster. Is the overhead of profile keeping track of calls in Python getting in the way? correct. And why can map() keep everything at the C level when the list com- prehension can't? map

Re: Problem of function calls from map()

2006-08-22 Thread Peter Otten
Dasn wrote: # size of 'dict.txt' is about 3.6M, 154563 lines f = open('dict.txt', 'r') lines = f.readlines() def sp0(lines): sp0() -- Normal 'for' loop l = [] for line in lines: l.append(line.split('\t')) return l Where do you get

Re: Problem of function calls from map()

2006-08-22 Thread Georg Brandl
Paul McGuire wrote: Dasn [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, there. 'lines' is a large list of strings each of which is seperated by '\t' lines = ['bla\tbla\tblah', 'bh\tb\tb', ... ] I wanna split each string into a list. For speed, using map() instead

Re: Problem of function calls from map()

2006-08-22 Thread Sion Arrowsmith
): sp4() -- Not correct, but very fast return map(str.split, lines) for num in xrange(5): fname = 'sp%(num)s' % locals() print eval(fname).__doc__ profile.run(fname+'(lines)') sp1() -- List-comprehension 154567 function calls in 12.240 CPU seconds

Re: Problem of function calls from map()

2006-08-22 Thread Paul McGuire
', ... ] I wanna split each string into a list. For speed, using map() instead of 'for' loop. snip def splitUsing(chars): def tmp(s): return s.split(chars) return tmp for d in map(splitUsing('\t'), data): print d And why is this better than map(lambda t: t.split

Re: Problem of function calls from map()

2006-08-22 Thread Fredrik Lundh
Sion Arrowsmith wrote: I think there's something weird going on -- sp4 should be making 154563 calls to str.split. So no wonder it goes faster -- it's not doing any work. of course it does: lines = [line\tone, line\ttwo] [s.split(\t) for s in lines] [['line', 'one'], ['line', 'two']] map

Re: Problem of function calls from map()

2006-08-22 Thread Sion Arrowsmith
), it's fractional, rather than the OP's four times faster. Is the overhead of profile keeping track of calls in Python getting in the way? (Not having used profile -- hence my confusion.) And why can map() keep everything at the C level when the list comprehension can't? -- \S -- [EMAIL PROTECTED

Re: Problem of function calls from map()

2006-08-22 Thread Fredrik Lundh
() *is* faster than split(\t), it's fractional, rather than the OP's four times faster. Is the overhead of profile keeping track of calls in Python getting in the way? correct. And why can map() keep everything at the C level when the list com- prehension can't? map is called with two Python

Problem of function calls from map()

2006-08-21 Thread Dasn
Hi, there. 'lines' is a large list of strings each of which is seperated by '\t' lines = ['bla\tbla\tblah', 'bh\tb\tb', ... ] I wanna split each string into a list. For speed, using map() instead of 'for' loop. 'map(str.split, lines)' works fine , but... when I was trying: l = map(str.split

Re: Problem of function calls from map()

2006-08-21 Thread Tim Lesher
Dasn wrote: So how to put '\t' argument to split() in map() ? How much is the lambda costing you, according to your profiler? Anyway, what you really want is a list comprehension: l = [line.split('\t') for line in lines] -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem of function calls from map()

2006-08-21 Thread Diez B. Roggisch
Dasn wrote: Hi, there. 'lines' is a large list of strings each of which is seperated by '\t' lines = ['bla\tbla\tblah', 'bh\tb\tb', ... ] I wanna split each string into a list. For speed, using map() instead of 'for' loop. 'map(str.split, lines)' works fine , but... when I was trying

Re: Problem of function calls from map()

2006-08-21 Thread Paul McGuire
Dasn [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, there. 'lines' is a large list of strings each of which is seperated by '\t' lines = ['bla\tbla\tblah', 'bh\tb\tb', ... ] I wanna split each string into a list. For speed, using map() instead of 'for' loop. Try

Re: Problem of function calls from map()

2006-08-21 Thread Paul McGuire
tmp is the function that split will call once per list item should be tmp is the function that *map* will call once per list item -- Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem of function calls from map()

2006-08-21 Thread Dasn
sp1(lines): sp1() -- List-comprehension return [s.split('\t') for s in lines] def sp2(lines): sp2() -- Map with lambda function return map(lambda s: s.split('\t'), lines) def sp3(lines): sp3() -- Map with splitUsing() function return

Re: map() return of flat tuple list

2006-06-23 Thread Mirco Wahab
Thus spoke [EMAIL PROTECTED] (on 2006-06-23 00:57): Maybe you want something like this (but this doesn't use map): [(r,c) for r, row in enumerate(m) for c in xrange(len(row))] Ahh, its a 'list comprehension', nice. Now, lets see how the decorate/undecorate sort turns out to look in Python

Re: map() return of flat tuple list

2006-06-23 Thread bearophileHUGS
Mirco: He, this looks more like Haskell than like Python (for me, it looks awful ;-) Maybe this is more readable: ar = [[3,3,3,3], [3,3,3,1], [3,3,4,3]] print sorted( [(r,c) for r,row in enumerate(ar) for c in xrange(len(row))], key=lambda (r,c): ar[r][c]

map() return of flat tuple list

2006-06-22 Thread Mirco Wahab
Hi, I have a 2D array, maybe irregular, like arr = [[2,2,2,2], [2,2,2,2], [2,2,2,2]] if tried to pull an index list (tuples or array elements) of all positions - via the map funtion, but failed. I tried to get sth. like [ [0,0], [0,1], [0,2], ... ] for each element which

Re: map() return of flat tuple list

2006-06-22 Thread bearophileHUGS
Maybe you want something like this (but this doesn't use map): def indexes(m): return [(r,c) for r, row in enumerate(m) for c in xrange(len(row))] m1 = [[2,2,5], [2,2], [2,2,2,2]] m2 = [[], [2], [1,2,3,4]] print indexes(m1) print indexes(m2) Output: [(0, 0), (0, 1

Looking for examples related to advanced python string, list and map operations

2006-06-15 Thread A.M
Hi, Is there any online resource that gives examples about advanced python string, list and map operations? Today I saw this and I found that I have to work more on mentioned topics: numbers = [72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33] print filter(lambda n: n % 2

Re: Looking for examples related to advanced python string, list and map operations

2006-06-15 Thread James Stroud
A.M wrote: Hi, Is there any online resource that gives examples about advanced python string, list and map operations? Today I saw this and I found that I have to work more on mentioned topics: numbers = [72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 33] print

Re: Looking for examples related to advanced python string, list and map operations

2006-06-15 Thread gene tani
A.M wrote: Hi, Is there any online resource that gives examples about advanced python string, list and map operations? http://goog-goopy.sourceforge.net/goopy.functional.html#-variance http://oakwinter.com/code/functional/documentation.html -- http://mail.python.org/mailman/listinfo

Re: using target words from arrays in regex, pythons version of perls 'map'

2006-05-16 Thread Paddy
I don't like string interpolation within REs, it pops me out of 'RE mode' as I scan the line. Maybe creating a dict of matchobjects could be used in the larger context?: dict( [(t, re.search(t+regexp_tail, file2) for t in targets] ) (untested). - Pad. --

Re: using target words from arrays in regex, pythons version of perls 'map'

2006-05-16 Thread John Machin
Think about how well the above solutions scale as len(targets) increases. 1. Make targets a set, not a list. 2. Have *ONE* regex which includes a bracketed match for a generic target e.g. ([A-Z\s]+) 3. Do *ONE* regex search, not 1 per target 4. If successful, check if the bracketed gizmoid is in

Re: using target words from arrays in regex, pythons version of perls 'map'

2006-05-16 Thread John Machin
Would you believe steps 3 4? -- http://mail.python.org/mailman/listinfo/python-list

Re: using target words from arrays in regex, pythons version of perls 'map'

2006-05-16 Thread Paul McGuire
Dennis Lee Bieber [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Mon, 15 May 2006 19:41:39 -0500, Lance Hoffmeyer [EMAIL PROTECTED] declaimed the following in comp.lang.python: I would have something similar to perl above: targets = ['OVERALL RATING',

Re: using target words from arrays in regex, pythons version of perls 'map'

2006-05-16 Thread Edward Elliott
John Machin wrote: Would you believe steps 3 4? How about two pops and a pass? Quick! Lower the cone of silence! -- Edward Elliott UC Berkeley School of Law (Boalt Hall) complangpython at eddeye dot net -- http://mail.python.org/mailman/listinfo/python-list

using target words from arrays in regex, pythons version of perls 'map'

2006-05-15 Thread Lance Hoffmeyer
', 'SHOES', 'FINE JEWELRY'); my @JA13 = map { $file2 =~/$_.*?(?:(\d{1,3}\.\d)\s+){3}/s; } @targets; So, in python instead of match2 = re.search('OVEWRALL RATING.*?(?:(\d{1,3}\.\d)\s+){3} ', file2);m01 = match2.group(1) ;print m01 match2

recursive map on nested list

2006-03-21 Thread alexandre_irrthum
Hello, I'd like to apply a function to elements of a nested list and wondered if there is anything more idiomatic and/or shorter than this recursive way: def recur_map(f, data): ... if isinstance(data, list): ... mapped_list = [] ... for i in data: ...

Re: recursive map on nested list

2006-03-21 Thread bearophileHUGS
I think for most purposes a program like this is short enough: def recur_map2(fun, data): if hasattr(data, __iter__): return [recur_map2(fun, elem) for elem in data] else: return fun(data) data = [set([1, 2]), [3], 4, [5, {6:4}, [7, 8]]] print recur_map2(lambda x: x*2,

Re: recursive map on nested list

2006-03-21 Thread johnzenger
Uglier than yours, but down to two lines: def recur_map(f, data): return [ not hasattr(x, __iter__) and f(x) or recur_map(f, x) for x in data ] -- http://mail.python.org/mailman/listinfo/python-list

[ python-Bugs-764493 ] test test_nis crashed -- nis.error: no such key in map

2006-03-06 Thread SourceForge.net
: no such key in map Initial Comment: I always ignored this test error, but maybe you want to fix this: test test_nis crashed -- nis.error: no such key in map $ ./python Lib/test/test_nis.py nis.maps() group.bygid.tmp mail.aliases n.strack strack Traceback (most recent call last

[ python-Bugs-764493 ] test test_nis crashed -- nis.error: no such key in map

2006-03-05 Thread SourceForge.net
: no such key in map Initial Comment: I always ignored this test error, but maybe you want to fix this: test test_nis crashed -- nis.error: no such key in map $ ./python Lib/test/test_nis.py nis.maps() group.bygid.tmp mail.aliases n.strack strack Traceback (most recent call last): File

[ python-Bugs-764493 ] test test_nis crashed -- nis.error: no such key in map

2006-02-19 Thread SourceForge.net
-- nis.error: no such key in map Initial Comment: I always ignored this test error, but maybe you want to fix this: test test_nis crashed -- nis.error: no such key in map $ ./python Lib/test/test_nis.py nis.maps() group.bygid.tmp mail.aliases n.strack strack Traceback (most recent call last

Reverse of map()?

2006-02-05 Thread Phillip Sitbon
Hello there, I have a situation where a list of functions need to be called with a single set of parameters and the result constructed into a tuple. I know there's simple ways to do it via list comprehension: Result = tuple( [ fn(* Args, ** Kwds) for fn in fn_list ] ) I'd hope there's a more

Re: Reverse of map()?

2006-02-05 Thread Alex Martelli
have to go with the list comprehension? A genexp is probably going to be more efficient than the list comprehension: just omit the brackets in your first snippet. map(apply, fn_list, ...) may work, but I doubt it's going to be either simple or speedy since the ... must be replaced with as many copies

Re: Reverse of map()?

2006-02-05 Thread Raymond Hettinger
[Alex Martelli] map(apply, fn_list, ...) may work, but I doubt it's going to be either simple or speedy since the ... must be replaced with as many copies of Args and Kwds as there are functions in fn_list, e.g.: map(apply, fn_list, len(fn_list)*(Args,), len(fn_list)*(Kwds)) The repeat

Map port to process

2006-01-05 Thread py
Is there a way in python to figure out which process is running on which port? I know in Windows XP you can run netstat -o and see the process ID for each open portbut I am looking for something not tied to windows particularly, hopefully something in python. if not, any known way, such as

Re: Map port to process

2006-01-05 Thread Diez B. Roggisch
py wrote: Is there a way in python to figure out which process is running on which port? I know in Windows XP you can run netstat -o and see the process ID for each open portbut I am looking for something not tied to windows particularly, hopefully something in python. if not, any

Re: Map port to process

2006-01-05 Thread Mike Meyer
py [EMAIL PROTECTED] writes: Is there a way in python to figure out which process is running on which port? I know in Windows XP you can run netstat -o and see the process ID for each open portbut I am looking for something not tied to windows particularly, hopefully something in python.

Re: should python have a sort list-map object in the std-lib?

2005-11-28 Thread Steven D'Aprano
On Sun, 27 Nov 2005 23:35:03 -0500, Tim Henderson wrote: Hi The question why are there no sorted dictionaries in python, seems to pop up with unseeming regularity. That question in itself in nonsensical sense dictionaries are hash-maps, however should python have a sorted map type object

Re: should python have a sort list-map object in the std-lib?

2005-11-28 Thread Alex Martelli
you need any sorting; if you need to walk sorted after each insertion or thereabouts, I would guess heap would be faster again. i may still look into writing a general sorted map though, it could be useful especially if there were and easy way to set the type of functionality required with out

should python have a sort list-map object in the std-lib?

2005-11-27 Thread Tim Henderson
Hi The question why are there no sorted dictionaries in python, seems to pop up with unseeming regularity. That question in itself in nonsensical sense dictionaries are hash-maps, however should python have a sorted map type object is a good question. clearly many people like have a sorted map

Re: should python have a sort list-map object in the std-lib?

2005-11-27 Thread Alex Martelli
Tim Henderson [EMAIL PROTECTED] wrote: ... Hi The question why are there no sorted dictionaries in python, seems to pop up with unseeming regularity. That question in itself in nonsensical sense dictionaries are hash-maps, however should python have a sorted map type object is a good

Re: should python have a sort list-map object in the std-lib?

2005-11-27 Thread Tim Henderson
ahh, i hadn't thought of using a proirity queue but that is the correct solution most of the time, except i suppose when you have input that causes you to excessively reheap which could be problematic. i may still look into writing a general sorted map though, it could be useful especially

Re: Hash map with multiple keys per value ?

2005-11-13 Thread Bengt Richter
On Fri, 11 Nov 2005 22:55:53 +, Chris Stiles [EMAIL PROTECTED] wrote: Hi -- I'm working on something that includes the concept of multiple aliases for a particular object, where a lookup for any of the aliases has to return all the others. The hack way of doing this was to have a dictionary

Re: Hash map with multiple keys per value ?

2005-11-12 Thread Alex Martelli
hard to say without knowing usecases and performance desiderata...), so you might have all aliases map to the same set of aliases and dynamically construct the required result by subtracting the lookup key itself. Another design issue is, however, how do you identify, when adding an alias, what

Re: Hash map with multiple keys per value ?

2005-11-12 Thread Bengt Richter
On Fri, 11 Nov 2005 22:55:53 +, Chris Stiles [EMAIL PROTECTED] wrote: Hi -- I'm working on something that includes the concept of multiple aliases for a particular object, where a lookup for any of the aliases has to return all the others. The hack way of doing this was to have a dictionary

Re: Hash map with multiple keys per value ?

2005-11-12 Thread Alex Martelli
Chris Stiles [EMAIL PROTECTED] wrote: ... alias insertion just be of the form x aliases to y rather than x names object XXX? In this case, strictly speaking there are no such thing as an 'object XXX', all the aliases are names for the object, each as important as each other. Fine, but,

Re: Hash map with multiple keys per value ?

2005-11-12 Thread Tom Anderson
On Fri, 11 Nov 2005, Chris Stiles wrote: Is there an easier and cleaner way of doing this ? Is there example code floating around that I might have a look at ? I'm not aware of a way which can honestly be called better. However, i do feel your pain about representing the alias relationships

Re: Hash map with multiple keys per value ?

2005-11-11 Thread snoe
Are you looking for this type of thing? class Test: value = 900 t = Test() d['1'] = t d['2'] = t d['3'] = t d['3'].value = 800 d['1'].value -- http://mail.python.org/mailman/listinfo/python-list

Re: Hash map with multiple keys per value ?

2005-11-11 Thread Robert Kern
Chris Stiles wrote: Hi -- I'm working on something that includes the concept of multiple aliases for a particular object, where a lookup for any of the aliases has to return all the others. The hack way of doing this was to have a dictionary where each entry consisted of a list of all the

Re: [OT] Map of email origins to Python list

2005-11-09 Thread Tom Anderson
On Mon, 7 Nov 2005, Claire McLister wrote: We've been working with Google Maps, and have created a web service to map origins of emails to a group. Top stuff! The misses are, if anything, more interesting than the hits! I, apparently, am in Norwich. I have been to Norwich a few times

Re: [OT] Map of email origins to Python list

2005-11-09 Thread Michael
Paul McGuire wrote: Claire McLister [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] We've been working with Google Maps, and have created a web service to map origins of emails to a group. As a trial, we've developed a map of emails to this group at: http://www.zeesource.net

Re: Map of email origins to Python list

2005-11-08 Thread Alan Kennedy
[Claire McLister] I've made the script available on our downloads page at: http://www.zeesource.net/downloads/e2i [Alan Kennedy] I look forward to the map with updated precision :-) [Claire McLister] Me too. Please let me know how we should modify the script. Having examined your script

[OT] Map of email origins to Python list

2005-11-07 Thread Claire McLister
We've been working with Google Maps, and have created a web service to map origins of emails to a group. As a trial, we've developed a map of emails to this group at: http://www.zeesource.net/maps/map.do?group=668 This represents emails sent to the group since October 27. Would like

Re: [OT] Map of email origins to Python list

2005-11-07 Thread Paul McGuire
Claire McLister [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] We've been working with Google Maps, and have created a web service to map origins of emails to a group. As a trial, we've developed a map of emails to this group at: http://www.zeesource.net/maps/map.do?group=668

Re: [OT] Map of email origins to Python list

2005-11-07 Thread Rocco Moretti
Paul McGuire wrote: Claire McLister [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] We've been working with Google Maps, and have created a web service to map origins of emails to a group. As a trial, we've developed a map of emails to this group at: http://www.zeesource.net

Re: [OT] Map of email origins to Python list

2005-11-07 Thread Steve Holden
Claire McLister wrote: We've been working with Google Maps, and have created a web service to map origins of emails to a group. As a trial, we've developed a map of emails to this group at: http://www.zeesource.net/maps/map.do?group=668 This represents emails sent to the group

Re: Map of email origins to Python list

2005-11-07 Thread [EMAIL PROTECTED]
Rocco Moretti wrote: Paul McGuire wrote: Claire McLister [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] We've been working with Google Maps, and have created a web service to map origins of emails to a group. As a trial, we've developed a map of emails to this group

Re: Map of email origins to Python list

2005-11-07 Thread Rocco Moretti
[EMAIL PROTECTED] wrote: Rocco Moretti wrote: It's also a testament to the limited value of physically locating people by internet addresses - If you zoom in on the San Fransico bay area, and click on the southern most bubble (south of San Jose), you'll see the entry for the Mountain View postal

Re: Map of email origins to Python list

2005-11-07 Thread Robert Kern
[EMAIL PROTECTED] wrote: North of that bubble is a second massive list also labeled Mountain View 94043. I found my name on that list and I live in the Chicago area. Moutain View is, perhaps, where aol.com is located? These bubbles are showing the location of the server that's registered

Re: Map of email origins to Python list

2005-11-07 Thread [EMAIL PROTECTED]
of the server that's registered under the domain name? Most of AOL's offices are in Dulles, VA. Google's headquarters are in Mountain View, CA. Aha, I post to the usenet through Google. Makes the map application all the more stupid, doesn't it? -- Robert Kern [EMAIL PROTECTED] In the fields

Re: Map of email origins to Python list

2005-11-07 Thread Alan Kennedy
[Robert Kern] Most of AOL's offices are in Dulles, VA. Google's headquarters are in Mountain View, CA. [EMAIL PROTECTED] Aha, I post to the usenet through Google. Makes the map application all the more stupid, doesn't it? Actually, no, because Google Groups sets the NNTP-Posting-Host header

Re: [OT] Map of email origins to Python list

2005-11-07 Thread Jorge Godoy
Claire McLister [EMAIL PROTECTED] writes: We've been working with Google Maps, and have created a web service to map origins of emails to a group. As a trial, we've developed a map of emails to this group at: http://www.zeesource.net/maps/map.do?group=668 This represents emails

Re: Map of email origins to Python list

2005-11-07 Thread [EMAIL PROTECTED]
Alan Kennedy wrote: [Robert Kern] Most of AOL's offices are in Dulles, VA. Google's headquarters are in Mountain View, CA. [EMAIL PROTECTED] Aha, I post to the usenet through Google. Makes the map application all the more stupid, doesn't it? Actually, no, because Google Groups sets

Re: Map of email origins to Python list

2005-11-07 Thread George Sakkis
Jorge Godoy [EMAIL PROTECTED]: H... I don't see mine listed there: I'm in South America, Brasil. More specifically in Curitiba, ParanĂ¡, Brasil. :-) That's funny; I was looking for mine and I stumbled across yours at Piscataway, NJ, US. :-) George --

Re: [OT] Map of email origins to Python list

2005-11-07 Thread Claire McLister
On Nov 7, 2005, at 9:55 AM, Paul McGuire wrote: I guess it's a great way to find where there might be Python jobs to be found, or at least kindred souls (or dissident Python posters in countries where Internet activity is closely monitored...) Possibly. But there are so many in-accuracies,

Re: [OT] Map of email origins to Python list

2005-11-07 Thread Claire McLister
On Nov 7, 2005, at 10:23 AM, Rocco Moretti wrote: It's also a testament to the limited value of physically locating people by internet addresses - If you zoom in on the San Fransico bay area, and click on the southern most bubble (south of San Jose), you'll see the entry for the Mountain

Re: Map of email origins to Python list

2005-11-07 Thread Alan Kennedy
[Alan Kennedy] So presumably chcgil indicates you're in Chicago, Illinois? [EMAIL PROTECTED] Yes, but why, then, is my name logged into Mountain View, CA? Presumably the creators of the map have chosen to use a mechanism other than NNTP-Posting-Host IP address to geolocate posters. Claire

Re: Map of email origins to Python list

2005-11-07 Thread Jorge Godoy
George Sakkis [EMAIL PROTECTED] writes: Jorge Godoy [EMAIL PROTECTED]: H... I don't see mine listed there: I'm in South America, Brasil. More specifically in Curitiba, ParanĂ¡, Brasil. :-) That's funny; I was looking for mine and I stumbled across yours at Piscataway, NJ, US. :-)

Re: [OT] Map of email origins to Python list

2005-11-07 Thread Claire McLister
On Nov 7, 2005, at 10:55 AM, Steve Holden wrote: Mostly I wonder what the point is. For example, given my own somewhat nomadic life I wondered what location has been used to map my own contributions. Just for fun, really. We try to a best job of mapping the IP location closest to the origins

<    4   5   6   7   8   9   10   11   12   >