Re: How to draw a dash line in the Tkinter?

2005-11-21 Thread Fredrik Lundh
"Shi Mu" wrote: > > > How to draw a dash line in the Tkinter? > > > > use the dash option. e.g. > > > >canvas.create_line(xy, fill="red", dash=(2, 4)) > >canvas.create_line(xy, fill="red", dash=(6, 5, 2, 4)) > > > > (the tuple contains a number of line lengths; lengths at odd positions >

Re: Why are there no ordered dictionaries?

2005-11-21 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > Fredrik Lundh wrote: > > > but you can easily generate an index when you need it: > > > > > > index = dict(d) > > > > > > name, type = index["pid"] > > > print name > > > > > > the index should take less than a microsecond to create

Any college offering Python short term course?

2005-11-21 Thread arches73
Hi, I want to learn Python. I appreciate if someone point me to the colleges / institutions offering any type of course in Python programming in the Bay area CA. Please send me the links to my email. Thanks, Arches -- http://mail.python.org/mailman/listinfo/python-list

python-dev Summary for 2005-10-01 through 2005-10-15

2005-11-21 Thread Tony Meyer
Title: python-dev Summary for 2005-10-01 through 2005-10-15Content-type: text/x-rstEncoding: utf-8python-dev Summary for 2005-10-01 through 2005-10-15 .. contents::[The HTML version of this Summary is available athttp://www.python.org/dev/summary/

Re: need help about time.sleep, timer

2005-11-21 Thread Sinan Nalkaya
Dennis Lee Bieber wrote: >On Fri, 18 Nov 2005 22:45:37 -0500, Peter Hansen <[EMAIL PROTECTED]> >declaimed the following in comp.lang.python: > > > >>It's quite unclear whether the last part, above, is one of your >>*requirements*, or a description of a problem you are having with your >>curren

Re: Web-based client code execution

2005-11-21 Thread Robin Becker
Paul Watson wrote: .. >> -- David > > > This looks interesting, but looks even more fragile than CrackAJAX. > > http://www.aminus.org/blogs/index.php/phunt/2005/10/06/subway_s_new_ajax_framework > > > > All of this comes down to Javascript which will still not allow me to > read local,

Re: setattr for secondary attribute

2005-11-21 Thread Alex
Great! Thanks, it works (of course). -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > If I need the dict feature 90% of the time, and the list feature 10% of > the time. Wasn't your use case that you wanted to specify form fields in a given order (LIST), render a default view of the form in that order (LIST), and, later on, access the field specifiers in

Re: Aproximative string matching

2005-11-21 Thread Daniel Dittmar
javuchi wrote: > I'm searching for a library which makes aproximative string matching, > for example, searching in a dictionary the word "motorcycle", but > returns similar strings like "motorcicle". > > Is there such a library? > agrep (aproximate grep) allows for a certain amount of errors and

Re: Why are there no ordered dictionaries?

2005-11-21 Thread [EMAIL PROTECTED]
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > > If I need the dict feature 90% of the time, and the list feature 10% of > > the time. > > Wasn't your use case that you wanted to specify form fields in > a given order (LIST), render a default view of the form in that > order (LIST), and, late

writing a generic method

2005-11-21 Thread fj
I am new in Python programming. I try to connect to Python various libraries written either in C of in Fortran. The job is not really hard but I meet a trouble when trying to build up a generic routine like in C++ or F90, i.e. a single routine name for various uses. Here is an example with a Fortr

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Antoon Pardon
Op 2005-11-21, Christoph Zwerschke schreef <[EMAIL PROTECTED]>: > [EMAIL PROTECTED] wrote: >> Personally, I have needs for ordered dict but I don't think it should >> be in standard library though, as different situation called for >> different behaviour for "ordered" and skewing my code to a stand

unittest can not use function name 'test' ?

2005-11-21 Thread [EMAIL PROTECTED]
Hello I found something strange in my unittest : This code is ok (will report error ): class MyTest1(unittest.TestCase): def runTest(self): self.assertEqual(2,3) pass if __name__ == '__main__': unittest.main() But if I add a function with the first name is 'test' it fa

Re: unittest can not use function name 'test' ?

2005-11-21 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I found something strange in my unittest : > This code is ok (will report error ): > > class MyTest1(unittest.TestCase): > > def runTest(self): > self.assertEqual(2,3) > pass > > if __name__ == '__main__': > unittest.main() > > But if I add a func

Re: Controlling windows gui applications from python

2005-11-21 Thread tim
Thanks for this tip, this looks like exactly what I need. Is there a more extended documentation for watsup somewhere ? I didn't find info on: how to send keystrokes to a program. how to control ComboBox elements... trying out the examples, here are some problems I am running into: I tried adapti

duplicate items in a list

2005-11-21 Thread Shi Mu
I used the following method to remove duplicate items in a list and got confused by the error. >>> a [[1, 2], [1, 2], [2, 3]] >>> noDups=[ u for u in a if u not in locals()['_[1]'] ] Traceback (most recent call last): File "", line 1, in ? TypeError: iterable argument required -- http://mail.py

Re: Aproximative string matching

2005-11-21 Thread Fredrik Lundh
Tim Roberts wrote: > >I'm searching for a library which makes aproximative string matching, > >for example, searching in a dictionary the word "motorcycle", but > >returns similar strings like "motorcicle". > > > >Is there such a library? > > There is an algorithm called Soundex that replaces each

Re: unittest can not use function name 'test' ?

2005-11-21 Thread [EMAIL PROTECTED]
Thanks Fredrik... pujo -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Ben Sizer
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > Using the same logic, we don't need types other than string in a DBMS > > as we can always convert a string field into some other types when it > > is needed. > > No, that's not the same logic. The dict() in my example doesn't convert be- > twee

Re: Controlling windows gui applications from python

2005-11-21 Thread tim
Thanks for this tip, this looks like exactly what I need. Is there a more extended documentation for watsup somewhere ? I didn't find info on: how to send keystrokes to a program. how to control ComboBox elements... trying out the examples, here are some problems I am running into: I tried adapti

Re: Problem printing in Win98

2005-11-21 Thread Dale Strickland-Clark
Maravilloso wrote: > Hi > > I'm trying to automatically send a postscript file to be printed to the > default printer in a Win98 PC, by means of using the instrucction: > > win32api.ShellExecute (0, "print", "file.ps", None, ".", 0) > > but it raises an exception with the message: > > erro

Re: duplicate items in a list

2005-11-21 Thread Fredrik Lundh
Shi Mu wrote: > I used the following method to remove duplicate items in a list and > got confused by the error. > > >>> a > [[1, 2], [1, 2], [2, 3]] > >>> noDups=[ u for u in a if u not in locals()['_[1]'] ] that's not portable, relies on CPython 2.4 implementation details, and shouldn't be used

tkinter and cygwin

2005-11-21 Thread [EMAIL PROTECTED]
Hi, I've recently started learning python programming and have been experimenting with a few basic GUI programs. My work system is cygwin/Windows XP. I use X-windows in cygwin but when I run my python/tkinter program from an x-win terminal , a normal XP window is opened up. Any text output from

Re: duplicate items in a list

2005-11-21 Thread Fredrik Lundh
Shi Mu wrote: > I used the following method to remove duplicate items in a list and > got confused by the error. > > >>> a > [[1, 2], [1, 2], [2, 3]] > >>> noDups=[ u for u in a if u not in locals()['_[1]'] ] > Traceback (most recent call last): > File "", line 1, in ? > TypeError: iterable argu

sort the list

2005-11-21 Thread Shi Mu
I have a list like [[1,4],[3,9],[2,5],[3,2]]. How can I sort the list based on the second value in the item? That is, I want the list to be: [[3,2],[1,4],[2,5],[3,9]] -- http://mail.python.org/mailman/listinfo/python-list

OSDC::Israel Conference 26-28 Feb. 2006

2005-11-21 Thread Amit Aronovitch
== Open Source Developers' Conference, 26-28 February, 2006, Netanya, Israel == Announcement and Call for Papers http://www.osdc.org.il/call_for_paper.html About -- The Open Source Developers' Conferences (OSDCs) are gras

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Fredrik Lundh
Ben Sizer wrote: > > No, that's not the same logic. The dict() in my example doesn't convert be- > > tween data types; it provides a new way to view an existing data structure. > > This is interesting; I would have thought that the tuple is read and a > dictionary created by inserting each pair s

Re: wxListBox and others after upgrade to MacOS X 10.4

2005-11-21 Thread isthar
Hi again more data: I upgraded to 2.6.x version of wxPython and tried to run my program ( using wxversion.switch('2.6') of course) - no results. Demo boudled with wxPython works well ( at least wxListBox ) BTW UI code was generated by wxGlade. Help Help Help -- http://mail.python.org/

Re: duplicate items in a list

2005-11-21 Thread Daniel Schüle
Shi Mu wrote: > I used the following method to remove duplicate items in a list and > got confused by the error. > > a > > [[1, 2], [1, 2], [2, 3]] > noDups=[ u for u in a if u not in locals()['_[1]'] ] > > Traceback (most recent call last): > File "", line 1, in ? > TypeError: itera

Re: sort the list

2005-11-21 Thread Daniel Schüle
Shi Mu wrote: > I have a list like [[1,4],[3,9],[2,5],[3,2]]. How can I sort the list > based on the second value in the item? > That is, > I want the list to be: > [[3,2],[1,4],[2,5],[3,9]] >>> lst = [[1,4],[3,9],[2,5],[3,2]] >>> lst [[1, 4], [3, 9], [2, 5], [3, 2]] >>> >>> >>> lst.sort(cmp

Re: termios.tcgetattr(fd) error: (22, 'Invalid argument')

2005-11-21 Thread Sinan Nalkaya
Petr Jakes wrote: >To provide some feedback: >As Grant Edwards posted in this list, I was running my code inside of >IDE that replaces sys.stdin with some other. While running the program >from a shell prompt, everything goes fine. >Petr Jakes > > > have you tried it with root account ? -- h

Re: sort the list

2005-11-21 Thread Shi Mu
On 11/21/05, Daniel Schüle <[EMAIL PROTECTED]> wrote: > Shi Mu wrote: > > I have a list like [[1,4],[3,9],[2,5],[3,2]]. How can I sort the list > > based on the second value in the item? > > That is, > > I want the list to be: > > [[3,2],[1,4],[2,5],[3,9]] > > > >>> lst = [[1,4],[3,9],[2,5],[3,2]]

Re: sort the list

2005-11-21 Thread Fredrik Lundh
Shi Mu wrote: > I have a list like [[1,4],[3,9],[2,5],[3,2]]. How can I sort the list > based on the second value in the item? > That is, > I want the list to be: > [[3,2],[1,4],[2,5],[3,9]] since you seem to be using 2.3, the solution is to use a custom compare function: >>> L = [[1,4],[3,9

Re: sqlite utf8 encoding error

2005-11-21 Thread Greg Miller
Thanks again, I'll look into this method. Greg Miller -- http://mail.python.org/mailman/listinfo/python-list

Re: duplicate items in a list

2005-11-21 Thread Steven D'Aprano
On Mon, 21 Nov 2005 02:49:56 -0800, Shi Mu wrote: > I used the following method to remove duplicate items in a list and > got confused by the error. > a > [[1, 2], [1, 2], [2, 3]] noDups=[ u for u in a if u not in locals()['_[1]'] ] > Traceback (most recent call last): > File "", line

Re[2]: termios.tcgetattr(fd) error: (22, 'Invalid argument')

2005-11-21 Thread Petr
>>To provide some feedback: >>As Grant Edwards posted in this list, I was running my code inside of >>IDE that replaces sys.stdin with some other. While running the program >>from a shell prompt, everything goes fine. >>Petr Jakes >> >> >> SN> have you tried it with root account ? Yes, I did.

Numeric array in unittest problem

2005-11-21 Thread [EMAIL PROTECTED]
hello, I found that if I use Numeric.array into unittest it is not consistance, Is that normal ? import Numeric class myTest(unittest.TestCase): def runTest(self): a = Numeric.array([1,2]) b = Numeric.array([1,33]) self.assertEqual(a, b) pass This will not raise

Re: Underscores in Python numbers

2005-11-21 Thread Antoon Pardon
Op 2005-11-20, Roy Smith schreef <[EMAIL PROTECTED]>: > [EMAIL PROTECTED] (David M. Cooke) wrote: > >> One example I can think of is a large number of float constants used >> for some math routine. In that case they usually be a full 16 or 17 >> digits. It'd be handy in that case to split into smal

PyCommandEvent

2005-11-21 Thread Karsten
Hello, I've got a question about Python Events. I want to generate a PyCommandEvent (included in the wx Package). This PyCommandEvent ought to be called when a method/function is called. I've seen some examples in the www how I can call the Event when an other Event is called. But this is not

Re: Aproximative string matching

2005-11-21 Thread Tim Heaney
"javuchi" <[EMAIL PROTECTED]> writes: > I'm searching for a library which makes aproximative string matching, > for example, searching in a dictionary the word "motorcycle", but > returns similar strings like "motorcicle". > > Is there such a library? I kind of like the one at http://www.pers

Re: Underscores in Python numbers

2005-11-21 Thread Scott David Daniels
Bruno Desthuilliers wrote: > So even if it's far from a common use case for *most* Python users, it > may be a common use case for *some* Python users. > > Also, someone mentionned the use of Python as a configuration langage - > which is probably a much more common use case. > > So FWIW, I'd b

Re: sort the list

2005-11-21 Thread Daniel Schüle
[...] >> >>> lst = [[1,4],[3,9],[2,5],[3,2]] >> >>> lst >>[[1, 4], [3, 9], [2, 5], [3, 2]] >> >>> >> >>> >> >>> lst.sort(cmp = lambda x,y: cmp(x[1], y[1])) >> >>> lst >>[[3, 2], [1, 4], [2, 5], [3, 9]] >> >>> >> >>works for Python 2.4 >>in earlier Pythons just let cmp = .. away >> >>Regards, Danie

Cross-Platform ReadKey

2005-11-21 Thread Dustan
I found this site that has the code for readkey for Windows, Unix, and in an updated version, Mac: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/134892 . The Mac object returns a character whether or not a key was pressed. I modified the Windows object to do the same when I downloaded i

Re: ownership problem?

2005-11-21 Thread Jeffrey Schwab
Fredrik Lundh wrote: > Jeffrey Schwab wrote: > > >>>the problem isn't determining who owns it, the problem is determining >>>who's supposed to release it. that's not a very common problem in a >>>garbage-collected language... >> >>Yes it is. Memory is only one type of resource. > > > Python's

Re: tkinter and cygwin

2005-11-21 Thread Jason Tishler
John, On Mon, Nov 21, 2005 at 08:18:09PM +0900, John wrote: > I've recently started learning python programming and have been > experimenting with a few basic GUI programs. My work system is > cygwin/Windows XP. I use X-windows in cygwin but when I run my > python/tkinter program from an x-win t

Re: ownership problem?

2005-11-21 Thread Fredrik Lundh
Jeffrey Schwab wrote: > >>>the problem isn't determining who owns it, the problem is determining > >>>who's supposed to release it. that's not a very common problem in a > >>>garbage-collected language... > >> > >>Yes it is. Memory is only one type of resource. > > > > Python's garbage collector

Re: is parameter an iterable?

2005-11-21 Thread Fredrik Lundh
Steven D'Aprano wrote: > Alas and alack, I have to write code which is backwards > compatible with older versions of Python: > > Python 2.1.1 (#1, Aug 25 2001, 04:19:08) > [GCC 3.0.1] on sunos5 > Type "copyright", "credits" or "license" for more > information. > >>> iter > Traceback (most recent

Re: Raw string fu

2005-11-21 Thread 'Dang' Daniel Griffith
On 26 Oct 2005 12:27:53 -0700, "Paul McGuire" <[EMAIL PROTECTED]> wrote: >"Raw string fu"? A new martial art? For the udon-aware. --dang -- http://mail.python.org/mailman/listinfo/python-list

Re: Numeric array in unittest problem

2005-11-21 Thread Peter Hansen
[EMAIL PROTECTED] wrote: > hello, > > I found that if I use Numeric.array into unittest it is not > consistance, > Is that normal ? > > import Numeric > class myTest(unittest.TestCase): > def runTest(self): > a = Numeric.array([1,2]) > b = Numeric.array([1,33]) > self.

Re: sort the list

2005-11-21 Thread Fredrik Lundh
Daniel Schüle wrote: > > what does let cmp = .. away mean? > > it means > lst.sort(lambda x,y: cmp(x[1], y[1])) note that cmp= isn't needed under 2.4 either. if you leave it out, your code will be more portable. -- http://mail.python.org/mailman/listinfo/python-list

Re: ownership problem?

2005-11-21 Thread Jeffrey Schwab
Fredrik Lundh wrote: > Jeffrey Schwab wrote: > > >the problem isn't determining who owns it, the problem is determining >who's supposed to release it. that's not a very common problem in a >garbage-collected language... Yes it is. Memory is only one type of resource. >>> >>

Re: Configure failing why?

2005-11-21 Thread Samuel M. Smith
I found a workaround,that is, to disable attribute caching using the "noac" nfs option. #These two worked on tiger 10.4.3 exec -c "console=ttyAM0,115200 ip=10.0.2.155:10.0.2.150:10.0.2.1:255.255.255.0:ts7250 nfsroot=10.0.2.150:/Data/nfsroot,noac" #fstab entry they have to match 10.0.2.150:

Re: need help about time.sleep, timer

2005-11-21 Thread Steve Holden
Sinan Nalkaya wrote: > Dennis Lee Bieber wrote: > > >>On Fri, 18 Nov 2005 22:45:37 -0500, Peter Hansen <[EMAIL PROTECTED]> >>declaimed the following in comp.lang.python: >> >> >> >> >>>It's quite unclear whether the last part, above, is one of your >>>*requirements*, or a description of a probl

Re: Web-based client code execution

2005-11-21 Thread Paul Watson
Robin Becker wrote: > Paul Watson wrote: > .. > >>> -- David >> >> >> >> This looks interesting, but looks even more fragile than CrackAJAX. >> >> http://www.aminus.org/blogs/index.php/phunt/2005/10/06/subway_s_new_ajax_framework >> >> >> >> All of this comes down to Javascript which will st

Re: Any royal road to Bezier curves...?

2005-11-21 Thread Terry Hancock
On Sun, 20 Nov 2005 23:33:36 -0500 "Warren Francis" <[EMAIL PROTECTED]> wrote: > I'm fairly new to Python (2-3 months) and I'm trying to > figure out a simple way to implement Bezier curves... So > far I've tried the following: > > http://runten.tripod.com/NURBS/ > ...which won't work because th

Re: sort the list

2005-11-21 Thread Giovanni Bajo
Fredrik Lundh wrote: >> I have a list like [[1,4],[3,9],[2,5],[3,2]]. How can I sort the list >> based on the second value in the item? >> That is, >> I want the list to be: >> [[3,2],[1,4],[2,5],[3,9]] > > since you seem to be using 2.3, the solution is to use a custom > compare function: > >

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Fuzzyman
Fredrik Lundh wrote: > Ben Sizer wrote: > > > > No, that's not the same logic. The dict() in my example doesn't convert > > > be- > > > tween data types; it provides a new way to view an existing data > > > structure. > > > > This is interesting; I would have thought that the tuple is read and

Re: duplicate items in a list

2005-11-21 Thread drochom
http://groups.google.com/group/comp.lang.python/browse_thread/thread/32e545ebba11dd4d/49a9f0cc799cc1f1#49a9f0cc799cc1f1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Underscores in Python numbers

2005-11-21 Thread Micah Elliott
On Nov 19, Steven D'Aprano wrote: > Perhaps Python should concatenate numeric literals at compile time: > > 123 456 is the same as 123456. +1 for readability. But in support of no change, When was the last time you looked at long sequences of python digits outside of your editor/IDE? You probab

Re: Web-based client code execution

2005-11-21 Thread Fuzzyman
Paul Watson wrote: > John J. Lee wrote: [snip..] > I appreciate your long list of references. For this task, I think the > first answer may have to be the one with which to go. A standard > application that talks through port 80 and perhaps can use proxies. > > My desire to have the code distrib

Re: Numeric array in unittest problem

2005-11-21 Thread [EMAIL PROTECTED]
Sorry Peter, Try this import unittest import Numeric class myTest(unittest.TestCase): def runTest(self): var1 = Numeric.array([1,22]) var2 = Numeric.array([1,33]) self.assertEqual(var1,var2) if __name__ == '__main__': unittest.main() pujo -- http://ma

Re: best cumulative sum

2005-11-21 Thread David Isaac
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > He seems to want scanl Yes. But it's not in Python, right? (I know about Keller's version.) Robert Kern wrote: > Define better. More accurate? Less code? Good point. As Bonono (?) suggested: I'd most like a solution that relies on a

Re: writing a generic method

2005-11-21 Thread fj
Nice ! Thank you very much : it works well with "s#s#O" And also thank you for your advice to insert PyErr_Clear() when several calls to PyArgParseTuple are performed in the same method. bye FJ -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: ... > d = somedict_from_db() > prefer=['f','a',b'] > > def my_order(d): >for x in prefer: > if x in d: yield x >s = frozenset(prefer) >for x in d: > if x not in s: yield x Yes, a much cleaner architecture (if you don't need any

Re: writing a generic method

2005-11-21 Thread jepler
You could use a format like "#s#sO", and then use PyFloat_Check, PyFloat_AsDouble, and the equivalent PyInt macros to get the "C" value out of the Python object. You should be able to use the converter "O&" to get what you want. The conversion function might look like: int double_only(PyO

OSDC::Israel Conference 26-28 Feb. 2006

2005-11-21 Thread Amit Aronovitch
== Open Source Developers' Conference, 26-28 February, 2006, Netanya, Israel == Announcement and Call for Papers http://www.osdc.org.il/call_for_paper.html About -- The Open Source Developers' Conferences (OSDCs) are gras

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Fredrik Lundh
"Fuzzyman" wrote: > [snip..] > > (as an example, on my machine, using Foord's OrderedDict class > > on Zwerschke's example, creating the dictionary in the first place > > takes 5 times longer than the index approach, and accessing an > > item takes 3 times longer. you can in fact recreate the ind

Re: Numeric array in unittest problem

2005-11-21 Thread Robert Kern
[EMAIL PROTECTED] wrote: > hello, > > I found that if I use Numeric.array into unittest it is not > consistance, > Is that normal ? > > import Numeric > class myTest(unittest.TestCase): > def runTest(self): > a = Numeric.array([1,2]) > b = Numeric.array([1,33]) > self.

Re: Numeric array in unittest problem

2005-11-21 Thread Alex Martelli
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Sorry Peter, > > Try this > > import unittest > import Numeric > > class myTest(unittest.TestCase): > def runTest(self): > var1 = Numeric.array([1,22]) > var2 = Numeric.array([1,33]) > self.assertEqual(var1,var2) >

RE: Any college offering Python short term course?

2005-11-21 Thread bruce
hey... i'm looking for classes (advanced) in python/php in the bay area as well... actually i'm looking for the students/teachers/profs of these classes... any idea as to how to find them. calling the various schools hasn't really been that helpful. The schools/institutions haven't had a good/larg

Re: sort the list

2005-11-21 Thread Duncan Booth
Daniel Schüle wrote: > I can offer you some more brain food to digest ;) > maybe you can adapt this solution, but that depends > on your problem > I find it clear and I used it recently > > >>> name, age, salary = "name", "age", "salary" > >>> people = [ > ... {name:"oliver", age:25, salary:1800}

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Christoph Zwerschke
Ben Finney wrote: >>> Another possibility: ordered dictionaries are not needed when Python >>> 2.4 has the 'sorted' builtin. Christoph Zwerschke wrote: >> The 'sorted' function does not help in the case I have indicated, >> where "I do not want the keys to be sorted alphabetically, but >> a

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Christoph Zwerschke
Fredrik Lundh wrote: > (as an example, on my machine, using Foord's OrderedDict class > on Zwerschke's example, creating the dictionary in the first place > takes 5 times longer than the index approach, and accessing an > item takes 3 times longer. you can in fact recreate the index 6 > times befo

Re: Immutable instances, constant values

2005-11-21 Thread George Sakkis
Steven D'Aprano wrote: > Yes, that would be how I interpret constants: You want a name which can't > be re-bound to something else. > > One work-around is to use the convention of writing the name in all caps: > > CONSTANT = some_value > > and then trust that your module user doesn't rebind CONSTA

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Alex Martelli
Fredrik Lundh <[EMAIL PROTECTED]> wrote: ... > ("but assume that I have some other use case" isn't a valid use > case) +1 QOTW Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Christoph Zwerschke
Alex Martelli wrote: > Note the plural in 'insertion orderS': some people care about the FIRST > time a key was added to a dict, some about the LAST time it was added, > some about the latest time it was 'first inserted' (added and wasn't > already there) as long as it's never been deleted since t

Re: best cumulative sum

2005-11-21 Thread Colin J. Williams
David Isaac wrote: > <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>He seems to want scanl > > > Yes. But it's not in Python, right? > (I know about Keller's version.) > > Robert Kern wrote: > >>Define better. More accurate? Less code? > > > Good point. > As Bonono (?) su

Re: about sort and dictionary

2005-11-21 Thread Magnus Lycka
[EMAIL PROTECTED] wrote: > most built-in function/method don't return the "object" but None. This > I believe is the language creator's preference for everything being > explicit. The list methods .sort() and .reverse() don't create copies, but rather change the existing object. The reson for thi

Re: about sort and dictionary

2005-11-21 Thread George Sakkis
"Shi Mu" wrote: > Got confused by the following code: > >>> a [6, 3, 1] > >>> b [4, 3, 1] > >>> c > {1: [[6, 3, 1], [4, 3, 1]], 2: [[6, 3, 1]]} > >>> c[2].append(b.sort()) > >>> c > {1: [[6, 3, 1], [1, 3, 4]], 2: [[6, 3, 1], None]} > #why c can not append the sorted b?? In python 2.4, you can

Re: about sort and dictionary

2005-11-21 Thread George Sakkis
"Shi Mu" wrote: > Got confused by the following code: > >>> a [6, 3, 1] > >>> b [4, 3, 1] > >>> c > {1: [[6, 3, 1], [4, 3, 1]], 2: [[6, 3, 1]]} > >>> c[2].append(b.sort()) > >>> c > {1: [[6, 3, 1], [1, 3, 4]], 2: [[6, 3, 1], None]} > #why c can not append the sorted b?? In python 2.4, you can

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Aahz
In article <[EMAIL PROTECTED]>, Alex Martelli <[EMAIL PROTECTED]> wrote: > >I think you're wrong here. People in the past who have requested or >implemented stuff they called 'ordered dicts' in the past had in mind >drastically different things, based on some combination of insertion >orders, keys

Re: Numeric array in unittest problem

2005-11-21 Thread Robert Kern
Alex Martelli wrote: import Numeric a=Numeric.array([1,22]) b=Numeric.array([1,33]) c = a==b c > > array([1, 0]) > assert(c) > > i.e., thanks to element-by-element evaluation, == will generally return > a true value for ANY comparison of Numeric arrays, causing a very >

Advice on distutils and distribution policies

2005-11-21 Thread Mardy
Hi, I've built a small project (http://eligante.sf.net) which I'm actually trying to package using distutils. The directory structure is going to be like this: eligante/ eligante.py sitobase.py personas.py [...other python files...] modulos/

ignore specific data

2005-11-21 Thread pkilambi
Hi I need help. What I want to do is If I read a file with some text content... I would like to ignore a block of lines and consider the rest.. so if the block starts with "start of block." fjesdgsdhfgdlgjklfjdgkd jhcsdfskdlgjkljgkfdjkgj "end of block" I want to ignore this while proc

Re: Numeric array in unittest problem

2005-11-21 Thread Roman Bertle
* Alex Martelli <[EMAIL PROTECTED]>: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > Sorry Peter, > > > > Try this > > > > import unittest > > import Numeric > > > > class myTest(unittest.TestCase): > > def runTest(self): > > var1 = Numeric.array([1,22]) > > var2 =

the name of a module in which an instance is created?

2005-11-21 Thread Steven Bethard
The setup: I'm working within a framework (designed by someone else) that requires a number of module globals to be set. In most cases, my modules look like: (1) a class definition (2) the creation of one instance of that class (3) binding of the instance methods to the appropriate module global

Re: ignore specific data

2005-11-21 Thread skip
pkilambi> I would like to ignore a block of lines and consider the pkilambi> rest.. so if the block starts with pkilambi> "start of block." pkilambi> fjesdgsdhfgdlgjklfjdgkd pkilambi> jhcsdfskdlgjkljgkfdjkgj pkilambi> "end of block" pkilambi> I want to ig

Re: Aproximative string matching

2005-11-21 Thread Diez B. Roggisch
Steven D'Aprano wrote: > [EMAIL PROTECTED] wrote: > >> This algorithm is called soundex. Here is one implementation example. >> >> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52213 >> >> here is another: >> http://effbot.org/librarybook/soundex.htm > > > Soundex is *one* particular a

Re: Any royal road to Bezier curves...?

2005-11-21 Thread Tom Anderson
On Sun, 20 Nov 2005, Warren Francis wrote: > Basically, I'd like to specify a curved path of an object through space. > 3D space would be wonderful, but I could jimmy-rig something if I could > just get 2D... Are bezier curves really what I want after all? No. You want a natural cubic spline:

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Tom Anderson
On Sun, 20 Nov 2005, Alex Martelli wrote: > Christoph Zwerschke <[EMAIL PROTECTED]> wrote: > >> The 'sorted' function does not help in the case I have indicated, where >> "I do not want the keys to be sorted alphabetically, but according to >> some criteria which cannot be derived from the keys

compiling Python under Windows

2005-11-21 Thread Philippe C. Martin
Hi, I'm currently blocking on bzip2: python is in c:\python.2.4.2 and bz2 is in c:\bzip2-1.0.3 Since the readme say subprojects should be two directories above PCbuild, I assume I'm OK. I added c:\bzip2-1.0.3 to the include and link path, but I get: """ Performing Pre-Link Event ... The system

Re: compiling Python under Windows

2005-11-21 Thread Philippe C. Martin
My mistake: The makefile (as written in the readme!) looks for bzip 1.0.2 Sorry, Philippe Philippe C. Martin wrote: > Hi, > > I'm currently blocking on bzip2: > > python is in c:\python.2.4.2 > and bz2 is in c:\bzip2-1.0.3 > > Since the readme say subprojects should be two directories abov

Re: Underscores in Python numbers

2005-11-21 Thread Eric Jacoboni
[EMAIL PROTECTED] (Bengt Richter) writes: >>Eric Jacoboni, ne il y a 1435938104 secondes > Um, about your sig ... ;-) Well, i confess it's Ruby code... Maybe, one day, i will try to write a Python Version (with DateTime, i guess?) but i'm afraid it doesn't change the result. -- Eric Jacoboni, ne

Re: compiling Python under Windows

2005-11-21 Thread Philippe C. Martin
Philippe C. Martin wrote: > My mistake: The makefile (as written in the readme!) looks for bzip 1.0.2 > PS: since bzip.org does not have 1.0.2 source anymore, can I just rename 1.0.3 ? Regards, Philippe > Sorry, > > Philippe > > > > Philippe C. Martin wrote: > >> Hi, >> >> I'm currently

Re: ignore specific data

2005-11-21 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Hi I need help. What I want to do is If I read a file with some text > content... > I would like to ignore a block of lines and consider the rest.. > so if the block starts with > > "start of block." > fjesdgsdhfgdlgjklfjdgkd > jhcsdfskdlgjkljgkfdjkgj > "end

Re: best cumulative sum

2005-11-21 Thread David Isaac
> Alan Isaac wrote: >> Like SciPy's cumsum. "Colin J. Williams" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Doesn't numarray handle this? Sure. One might say that numarray is in the process of becoming scipy. But I was looking for a solution when these are available. Something

Re: Why are there no ordered dictionaries?

2005-11-21 Thread Kay Schluehr
Fredrik Lundh wrote: > huh? if you want a list, use a list. > > d = [('a', {...}), ('b', {})] If one wants uniform access to a nested data structure like this one usually starts writing a wrapper class. I do not think the requirement is anyhow deeper than a standard wrapper around such a

Help in File selector window in pygtk

2005-11-21 Thread Thierry Lam
Let's say I have a main window which has a File menu. When I click on the File menu and the open button, I have a File selector window which comes in front of my main window. How do I make the main window unselectable? Thanks Thierry -- http://mail.python.org/mailman/listinfo/python-list

Re: ignore specific data

2005-11-21 Thread pkilambi
thanks for that. But this will check for the exact content of the "start of block.." or "end of block". How about if the content is anywhere in the line? -- http://mail.python.org/mailman/listinfo/python-list

Reading a subprocesses stdout on Windows

2005-11-21 Thread brolewis
I have been trying for several weeks now to write a program that allows me to read the stdout of a process that I spawn and once I receive feedback, act appropriately. More specifically, I need to create an SSH tunnel using plink on Windows XP. Once the tunnel is successfully created, then I need

  1   2   >