Re: [Tutor] saving a numpy ndarray in sqlite3 (markus kossner)

2009-12-21 Thread Don Jennings
I am not familiar with numpy, but you might like to take a look at y_serial which allows you to store python objects in sqlite: http://yserial.sourceforge.net/ Take care, Don ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscripti

[Tutor] Rép. : How can I make this run faster ?

2009-12-21 Thread Luhmann
#Here's my try: vowel_killer_dict = { ord(a): None for a in 'aeiou'} def devocalize(word):     return word.translate(vowel_killer_dict) vowelled = ['him', 'ham', 'hum', 'fun', 'fan'] vowelled = set(vowelled) devocalise_dict={} for a in vowelled:     devocalise_dict[a]= devocalize(a)     un

Re: [Tutor] How can I make this run faster?

2009-12-21 Thread spir
Emad Nawfal (عمـ نوفل ـاد) dixit: > Dear Tutors, > The purpose of this script is to see how many vocalized forms map to a > single consonantal form. For example, the form "fn" could be fan, fin, fun. > > The input is a large list (taken from a file) that has ordinary words. The > script creates

Re: [Tutor] How can I make this run faster?

2009-12-21 Thread عمـ نوفل ـاد
2009/12/21 Alan Gauld > > "Emad Nawfal (عمـ نوفل ـاد)" wrote > > > def devocalize(word): >>vowels = "aiou" >> > Should this include 'e'? > > return "".join([letter for letter in word if letter not in vowels]) >> > > Its probably faster to use a regular expression replacement. > Simply r

Re: [Tutor] How can I make this run faster?

2009-12-21 Thread Alan Gauld
"Emad Nawfal (عمـ نوفل ـاد)" wrote def devocalize(word): vowels = "aiou" Should this include 'e'? return "".join([letter for letter in word if letter not in vowels]) Its probably faster to use a regular expression replacement. Simply replace any vowel with the empty string. vowell

Re: [Tutor] How can I make this run faster?

2009-12-21 Thread bob gailer
Emad Nawfal (عمـ نوفل ـاد) wrote: Dear Tutors, The purpose of this script is to see how many vocalized forms map to a single consonantal form. For example, the form "fn" could be fan, fin, fun. The input is a large list (taken from a file) that has ordinary words. What does "ordinary" mean

[Tutor] problem with socket connection

2009-12-21 Thread shawn bright
Hey all, I keep getting a connection error 111 connection refused. When i try to connect to a server at a remote ip address. I am using linux on both computers. the socket server looks like this: #!/usr/bin/python import SocketServer class MyTCPHandler(SocketServer.BaseRequestHandler): def

[Tutor] problem with socket connection

2009-12-21 Thread shawn bright
Hey all, I keep getting a connection error 111 connection refused. When i try to connect to a server at a remote ip address. I am using linux on both computers. the socket server looks like this: #!/usr/bin/python import SocketServer class MyTCPHandler(SocketServer.BaseRequestHandler): def

[Tutor] How can I make this run faster?

2009-12-21 Thread عمـ نوفل ـاد
Dear Tutors, The purpose of this script is to see how many vocalized forms map to a single consonantal form. For example, the form "fn" could be fan, fin, fun. The input is a large list (taken from a file) that has ordinary words. The script creates a devocalized list, then compares the two lists.

Re: [Tutor] subclass question

2009-12-21 Thread bob gailer
David Perlman wrote: If I make a subclass of a built-in class, like this: class mylist(list): def __init__(self): list.__init__(self) Then it is valid for me to do this: >>> x=mylist() >>> x.hello=3 >>> But I can't do this: >>> y=list() >>> y.hello=3 Traceback (most recent call l

[Tutor] saving a numpy ndarray in sqlite3

2009-12-21 Thread markus kossner
Dear Folks, I am wondering about the most efficient way to save a numpy.ndarray in a sqlite3 database file. I was initially thinking about using the 'buffer' type and creating a 'blob' field in the database. however the .from_buffer() routines in numpy assume the array to be recreated having