Re: [Tutor] How to use diff.py?
At 04:54 AM 1/27/2007, Kent Johnson wrote: Dick Moores wrote: At 12:16 PM 1/26/2007, you wrote: I've found diff.py in Python25\Tools\Scripts. But I don't see how to use it to find the differences between 2 files, say file1.txt and file2.txt. I was hoping it would work like unix's diff, but could someone explain? Here's one way: http://tinyurl.com/2lsleq Did that answer your question? Yes. I found I like the -m option. You can run diff.py from the command line, e.g. py c:/python25/tools/scripts/diff.py -c FindE3Audio.py FindE3NoAudio.py or py c:/python25/tools/scripts/diff.py -m FindE3Audio.py FindE3NoAudio.py Audio.htm Thanks, Kent. Dick ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] question about a list of lists
lo there all. i have a list of lists that i want to build, only if an item is not in the list already. kinda like this new_list = [] for item in lists: # item will look something like [var1, var2, var3] if item[0] in new_list ( only the first element of each list ) like new_list[0][0] basicly, i want to know if item[0] is one of the items[0] in my new_list whats a good pythonic way to do this? i mean, i have a couple of way to do this, but they are ugly. shawn ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Help Please
Hi, This may be too elementary for most of you, but could you please help me with the following question? I would like to use comprehensive lists and lists of lists. Where do I start? Question: Consider a digraph with 10 vertices, labeled 1 through 10. You are given the following adjacency list representation, where we first list the vertices adjacent to vertex 1, and so on. 1*; *2; 2*; *3; 3*; *4; 4*; *5; 5*; *6; 6*; *7; 7*; *8; 8*; *9; 9*; *10; 10. a) Write code to turn the adjacency list into an incidence list and an an adjacency matrix. b) Write code to turn the incidence list into an adjacency matrix. Hint: You may find it useful to note that one incidence list representation is (1*; *1), (2*; *2), (3*; *3), (4*; *4), (5*; *5),(6*; *6), (7*; *7), (8*; *8), (9*; *9), (10*; *10), (1*; *2), (2*; *3), (3*; *4), (4*; *5), (5*; *6), (6*; *7), (7*; *8), (8*; *9), (9*; *10). ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Please
This may be too elementary for most of you, but could you please help me with the following question? This is almost certainly a homework problem. We are very restricted in what we can do to help. See: http://www.catb.org/~esr/faqs/smart-questions.html#homework I would like to use comprehensive lists and lists of lists. Where do I start? These are basic list manipulation concepts. See any Python tutorial that talk about lists. For example: http://www.ibiblio.org/obp/thinkCSpy/chap08.html Other than refering you to tutorials, I don't think I can do much else here. Good luck. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Best IDE for Python
Vim and emacs are equally good shawn bright [EMAIL PROTECTED] wrote: i think pydev ( an eclipse plugin ) can too. shawn On 1/27/07, Dick Moores [EMAIL PROTECTED] wrote: At 07:12 PM 1/24/2007, Shadab Sayani wrote: Hi, I am using vim editor to code my project in python.Is there a good IDE where in I type the name of the class object and then dot then all the attributes of the object are displayed so on. Ulipad can do this. Dick Moores UliPad The Python Editor: http://wiki.woodpecker.org.cn/moin/UliPad ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor - Any questions? Get answers on any topic at Yahoo! Answers. Try it now.___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Does Python have any callback function?
Wong Vincent [EMAIL PROTECTED] wrote My current application has 2 python scripts running in parallel, say script A and B. script A: GUI script B: data processing. OK, Thats a slightly unusual way to do things unless the data processing is acting as a server for multiple clients. Normally we would write the data processing as a module that exposed some functions (or classes) that are called from the GUI and the GUI then updates the interface with the result. But assuming you must use two separate scripts running as two processes then you can still get them to interwork. Take a look at my tutorial under the topic inter-process-communication for how to use pipes. If it is a multi-client server (or iof the serrver is on another machine from the GUI) then sockets may be more appropriate (I haven't gotten round to finishing that topic yet! :-) A will invoke B to run. If I would like B to update processing status to A But since you say A invokles B I suspect pipes will be fine. But equally rewriting B as a module will be even better. -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] question about a list of lists
shawn bright [EMAIL PROTECTED] wrote new_list = [] for item in lists: # item will look something like [var1, var2, var3] if item[0] in new_list basicly, i want to know if item[0] is one of the items[0] in my new_list Your pseudo code is pretty much exactly right. What more are you looking for? Alan G. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Help Please
Python Freak [EMAIL PROTECTED] wrote This may be too elementary for most of you, but could you please help me with the following question? I would like to use comprehensive lists and lists of lists. Where do I start? Assuming you mean list comprehensions and lists of lists then most web tutorials (including mine) should include those topics What exactly don you not understand? The more specific the question the more specific will be the answer. Question: Consider a digraph with 10 vertices, labeled 1 through 10. You are given the following adjacency list representation, where we first list the vertices adjacent to vertex 1, and so on. 1*; *2; 2*; *3; 3*; *4; 4*; *5; 5*; *6; 6*; *7; 7*; *8; 8*; *9; 9*; *10; 10. Thats pretty specific but looks like a homework. We won't do your homework for you but we will help you with specific bits if you get stuck. But you need to show us that you are making a fair attempt yourself. -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Internal Python memory dump
Hi, Does anyone know where I can find documents of Internal python memory dump? thanks, Phon ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
[Tutor] Help Please
Hi, This may be too elementary for most of you, but could you please help me with the following question? I would like to use comprehensive lists and lists of lists. Where do I start? Question: Consider a digraph with 10 vertices, labeled 1 through 10. You are given the following adjacency list representation, where we first list the vertices adjacent to vertex 1, and so on. 1*; *2; 2*; *3; 3*; *4; 4*; *5; 5*; *6; 6*; *7; 7*; *8; 8*; *9; 9*; *10; 10. a) Write code to turn the adjacency list into an incidence list and an an adjacency matrix. b) Write code to turn the incidence list into an adjacency matrix. Hint: You may find it useful to note that one incidence list representation is (1*; *1), (2*; *2), (3*; *3), (4*; *4), (5*; *5),(6*; *6), (7*; *7), (8*; *8), (9*; *9), (10*; *10), (1*; *2), (2*; *3), (3*; *4), (4*; *5), (5*; *6), (6*; *7), (7*; *8), (8*; *9), (9*; *10). ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] question about a list of lists
shawn bright wrote: lo there all. i have a list of lists that i want to build, only if an item is not in the list already. kinda like this new_list = [] for item in lists: # item will look something like [var1, var2, var3] if item[0] in new_list ( only the first element of each list ) like new_list[0][0] basicly, i want to know if item[0] is one of the items[0] in my new_list whats a good pythonic way to do this? i mean, i have a couple of way to do this, but they are ugly. One way to do this is to keep a helper set that contains the first elements of each list. Something like new_list = [] firsts = set() for item in lists: if item[0] not in firsts: new_list.append(item) firsts.add(item[0] If you don't care about the order of the result, and if two lists have duplicate first items you are happy to use the first, then you could use a dict mapping first item to list: new_list = dict((item[0], item) for item in lists).values() Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor