Re: regarding memoize function

2008-04-03 Thread Gabriel Genellina
En Fri, 04 Apr 2008 02:24:14 -0300, <[EMAIL PROTECTED]> escribió: > On Apr 3, 8:04 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: >> En Thu, 03 Apr 2008 21:21:11 -0300, Dan Bishop <[EMAIL PROTECTED]>   >> escribió: >> > On Apr 3, 6:33 pm, [EMAIL PROTECTED] wrote: >> >> I saw example of memoize

When does a binary extension gets the file extension '.pyd' and when is it '.so'

2008-04-03 Thread llothar
On windows everything is '.pyd' but there seems to be two ways to get this on unix? Why and what is the rule? -- http://mail.python.org/mailman/listinfo/python-list

Re: Question.

2008-04-03 Thread Roy H. Han
Your boyfriend is pretty funny. I tried to get my girlfriend to learn Python a long time ago but she doesn't see value in it. On Fri, Apr 4, 2008 at 12:31 AM, AJay Grimmett <[EMAIL PROTECTED]> wrote: > My name is Amanda. My boyfriend sent me an encrypted message by using > python. I guess he tho

Re: Unicode conversion problem (codec can't decode)

2008-04-03 Thread Gabriel Genellina
En Fri, 04 Apr 2008 01:35:08 -0300, Eric S. Johansson <[EMAIL PROTECTED]> escribió: > I'm having a problem (Python 2.4) converting strings with random 8-bit > characters into an escape form which is 7-bit clean for storage in a > database. > Here's an example: > > body = meta['mini_body'].enco

Re: Unicode conversion problem (codec can't decode)

2008-04-03 Thread Jason Scheirer
On Apr 3, 9:35 pm, "Eric S. Johansson" <[EMAIL PROTECTED]> wrote: > I'm having a problem (Python 2.4) converting strings with random 8-bit > characters into an escape form which is 7-bit clean for storage in a database. > Here's an example: > > body = meta['mini_body'].encode('unicode-escape') > >

Re: Figuring out what class instance contains you

2008-04-03 Thread Gabriel Genellina
En Fri, 04 Apr 2008 00:41:19 -0300, Alex VanderWoude <[EMAIL PROTECTED]> escribió: > Consider the following module: > > > class NewDict(dict): > parent = None > > def __setitem__(self, key, value): > print "My parent is", self.parent >

Re: splitting an XML file on the basis on basis of XML tags

2008-04-03 Thread bijeshn
On Apr 3, 11:28 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > > I abuse it because I can (and because I don't generally work with XML > > files larger than 20-30meg) :) > > And the OP never said the XML file for 1TB in size, which makes things > > different. > > Even with small xml-files your

Re: python bisect questions

2008-04-03 Thread ankitks . mital
Thanks Gabriel -- http://mail.python.org/mailman/listinfo/python-list

Re: Python-by-example - new online guide to Python Standard Library

2008-04-03 Thread shurik
that's great! thanks for putting this together. what about the inspect module? and particularly getsource :) On Apr 1, 6:15 pm, AK <[EMAIL PROTECTED]> wrote: > Hello, > > I find that I learn easier when I go from specific examples to a more > general explanation of function's utility and I made a

Re: regarding memoize function

2008-04-03 Thread ankitks . mital
On Apr 3, 8:04 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 03 Apr 2008 21:21:11 -0300, Dan Bishop <[EMAIL PROTECTED]>   > escribió: > > > > > > > On Apr 3, 6:33 pm, [EMAIL PROTECTED] wrote: > >> I saw example of memoize function...here is snippet > > >> def memoize(fn, slot): > >>

Question.

2008-04-03 Thread AJay Grimmett
My name is Amanda. My boyfriend sent me an encrypted message by using python. I guess he thought it would be fun for me to figure it out for myself. This one involes a whole lotta numbers. I can't read or understand what I am supposed to do to read this message. I mean, I've read the information

Unicode conversion problem (codec can't decode)

2008-04-03 Thread Eric S. Johansson
I'm having a problem (Python 2.4) converting strings with random 8-bit characters into an escape form which is 7-bit clean for storage in a database. Here's an example: body = meta['mini_body'].encode('unicode-escape') when given an 8-bit string, (in meta['mini_body']), the code fragment above

Re: Parsing HTML?

2008-04-03 Thread 7stud
On Apr 3, 12:39 am, [EMAIL PROTECTED] wrote: > BeautifulSoup does what I need it to.  Though, I was hoping to find > something that would let me work with the DOM the way JavaScript can > work with web browsers' implementations of the DOM.  Specifically, I'd > like to be able to access the innerHTM

Figuring out what class instance contains you

2008-04-03 Thread Alex VanderWoude
Consider the following module: class NewDict(dict): parent = None def __setitem__(self, key, value): print "My parent is", self.parent super(NewDict, self).__setitem__(key, value) class Zero(object): children = NewDict() def

Re: Parsing HTML?

2008-04-03 Thread Larry Bates
On Wed, 2008-04-02 at 21:59 -0700, Benjamin wrote: > I'm trying to parse an HTML file. I want to retrieve all of the text > inside a certain tag that I find with XPath. The DOM seems to make > this available with the innerHTML element, but I haven't found a way > to do it in Python. I use Eleme

Re: Prototype OO

2008-04-03 Thread Larry Bates
On Wed, 2008-04-02 at 21:03 -0700, [EMAIL PROTECTED] wrote: > On Apr 2, 5:41 pm, "[EMAIL PROTECTED]" > <[EMAIL PROTECTED]> wrote: > > On 2 avr, 22:23, Paul Rubin wrote: > > > > > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > > > Fine. But totally irrelevant here -

Re: variable scope in list comprehensions

2008-04-03 Thread Steve Holden
Piotr Sobolewski wrote: > Hello, > > there is something I don't understand about list comprehensions. > > I understand how does this work: > print [[y for x in range(8)] for y in range(8)] > > However I don't understand why this one works: > print [[y for y in range(8)] for y in range(8)] > > I

Re: Any fancy grep utility replacements out there?

2008-04-03 Thread [EMAIL PROTECTED]
Thanks to everyone who responded, and sorry for my late response. Grin seems like the perfect solution for me. I finally had a chance to download it and play with it today. It's great. Robert...you were kind enough to ask if I had any requests. Just the one right now of grepping through gzip f

Re: Is there an official way to add methods to an instance?

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 22:43:30 -0300, Roger Miller <[EMAIL PROTECTED]> escribió: > On Apr 3, 2:57 pm, Brian Vanderburg II <[EMAIL PROTECTED]> > wrote: >> >> I've checked out some ways to get this to work. I want to be able to >> add a new function to an instance of an object. I've tested two >>

Re: Is there an official way to add methods to an instance?

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 21:57:56 -0300, Brian Vanderburg II <[EMAIL PROTECTED]> escribió: > I don't know if this is the correct place to send this question. > > I've checked out some ways to get this to work. I want to be able to > add a new function to an instance of an object. I've tested two >

RELEASED Python 2.6a2 and 3.0a4

2008-04-03 Thread Barry Warsaw
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On behalf of the Python development team and the Python community, I'm happy to announce the second alpha release of Python 2.6, and the fourth alpha release of Python 3.0. Please note that these are alpha releases, and as such are not suitable

Re: Is there an official way to add methods to an instance?

2008-04-03 Thread Roger Miller
On Apr 3, 2:57 pm, Brian Vanderburg II <[EMAIL PROTECTED]> wrote: > > I've checked out some ways to get this to work. I want to be able to > add a new function to an instance of an object. I've tested two > different methods that cause problems with 'deleting'/garbage collection > (__del__ may ne

Re: regarding memoize function

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 21:21:11 -0300, Dan Bishop <[EMAIL PROTECTED]> escribió: > On Apr 3, 6:33 pm, [EMAIL PROTECTED] wrote: >> I saw example of memoize function...here is snippet >> >> def memoize(fn, slot): >>def memoized_fn(obj, *args): >> if hasattr(obj, slot): >>

Is there an official way to add methods to an instance?

2008-04-03 Thread Brian Vanderburg II
I don't know if this is the correct place to send this question. I've checked out some ways to get this to work. I want to be able to add a new function to an instance of an object. I've tested two different methods that cause problems with 'deleting'/garbage collection (__del__ may never get

Re: displaying execution of Python code

2008-04-03 Thread ajaksu
On Apr 3, 6:13 pm, noahwatkins <[EMAIL PROTECTED]> wrote: > I'll start my question by describing my desired result. I will > construct a GUI which will be used to open a Python script. I would > then like to be able to display the Python script, execute it, and > highlight the lines of the Python a

Re: id functions of ints, floats and strings

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 19:27:47 -0300, <[EMAIL PROTECTED]> escribió: > Hi all, > > I've been playing around with the identity function id() for different > types of objects, and I think I understand its behaviour when it comes > to objects like lists and tuples in which case an assignment r2 = r1 > (

Re: regarding memoize function

2008-04-03 Thread Dan Bishop
On Apr 3, 6:33 pm, [EMAIL PROTECTED] wrote: > I saw example of memoize function...here is snippet > > def memoize(fn, slot): >def memoized_fn(obj, *args): > if hasattr(obj, slot): > return getattr(obj, slot) > else: > val = fn(obj, *ar

Re: Python in High School

2008-04-03 Thread John Henry
On Apr 3, 10:17 am, Stef Mientki <[EMAIL PROTECTED]> wrote: > >> Well I doubt it's the visual environment that makes it more easy, > >> color, shape and position can give some extra information though. > >> I think apriori domain knowledge and flattness of information are of far > >> more importanc

Re: Python in High School

2008-04-03 Thread John Henry
On Apr 3, 12:24 pm, ajaksu <[EMAIL PROTECTED]> wrote: > On Apr 2, 5:01 pm, John Henry <[EMAIL PROTECTED]> wrote: > > > However, once I start teaching him variables, expressions, loops, and > > what not, I found that (by surprise) he had great difficulties > > catching on. Not soon after that, we h

how to do "load script; run script" in a loop in embedded python?

2008-04-03 Thread lipingffeng
Hi, all, I am currently involved in a project that needs to load/run a python script dynamically in a C application. The sample code is as following: PyObject *LoadScript(char *file, char *func) { PyObject *pName, *pModule, *pDict, *pFunc; pName = PyString_FromString(file); pModule =

Re: expanding a variable to a dict

2008-04-03 Thread John Machin
On Apr 4, 9:44 am, Max M <[EMAIL PROTECTED]> wrote: > idle skrev: > > > now I'd like to check them all for the existence of certain default > > keys; ie, if the dicts don't contain the keys, add them in with > > default values. > > > so, I've got: > > > for a in ['dictFoo','dictBar','dictFrotz']: >

Re: displaying execution of Python code

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 18:13:25 -0300, noahwatkins <[EMAIL PROTECTED]> escribió: > More technically, I am looking for direction on where to start looking > in the Python libraries for a functionality that will allow me to > execute arbitrary Python code from within a Python application. > Additiona

Re: Bug in shlex??

2008-04-03 Thread [EMAIL PROTECTED]
Gabriel... I feel foolish...(and wish I had the two hours back I spent on this). :) Thank you so much! > The result is a list containing a single string. The string contains 5 > characters: a single backslash, a question mark, three letters. The > backslash is the escape character, as in '\n'

regarding memoize function

2008-04-03 Thread ankitks . mital
I saw example of memoize function...here is snippet def memoize(fn, slot): def memoized_fn(obj, *args): if hasattr(obj, slot): return getattr(obj, slot) else: val = fn(obj, *args) setattr(obj, slot, val)

Re: python bisect questions

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 19:21:19 -0300, <[EMAIL PROTECTED]> escribió: > On Apr 3, 4:24 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: >> <[EMAIL PROTECTED]> wrote in message >> >> news:[EMAIL PROTECTED] >> |I am week on functional programming, and having hard time >> | understanding this: >> | >> | clas

Re: python bisect questions

2008-04-03 Thread ankitks . mital
On Apr 3, 5:43 pm, John Machin <[EMAIL PROTECTED]> wrote: > On Apr 4, 9:21 am, [EMAIL PROTECTED] wrote: > > > > > > > On Apr 3, 4:24 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > > > <[EMAIL PROTECTED]> wrote in message > > > >news:[EMAIL PROTECTED] > > > |I am week on functional programming, an

Re: sine in python

2008-04-03 Thread Dan Bishop
On Apr 3, 6:09 pm, [EMAIL PROTECTED] wrote: > On Apr 3, 11:58 pm, Astan Chee <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > I have a math function that looks like this > > sin (Theta) = 5/6 > > How do I find Theta (in degrees) in python? I am aware of the math.sin > > function, but is there a reverse

Re: expanding a variable to a dict

2008-04-03 Thread Max M
idle skrev: > now I'd like to check them all for the existence of certain default > keys; ie, if the dicts don't contain the keys, add them in with > default values. > > so, I've got: > > for a in ['dictFoo','dictBar','dictFrotz']: > if hasattr(a,'srcdir') == False: > a['srcdir']='/u

variable scope in list comprehensions

2008-04-03 Thread Piotr Sobolewski
Hello, there is something I don't understand about list comprehensions. I understand how does this work: print [[y for x in range(8)] for y in range(8)] However I don't understand why this one works: print [[y for y in range(8)] for y in range(8)] In this second example I have one loop nested i

Re: Python-by-example - new online guide to Python Standard Library

2008-04-03 Thread Giampaolo Rodola'
On 2 Apr, 03:15, AK <[EMAIL PROTECTED]> wrote: > Hello, > > I find that I learn easier when I go from specific examples to a more > general explanation of function's utility and I made a reference guide > that will eventually document all functions, classes and methods in > Python's Standard Librar

Re: Easy-to-install-and-use scientific graphics (plotting) package for Python 2.5.1 on Linux Ubuntu 7.1

2008-04-03 Thread Robert Kern
Dr. Colombes wrote: > Is there an easy scientific graphics (plotting) package for Python > 2.5.1 running on Ubuntu Linux 7.1 ("Gutsy Gibbon")? > > A few years ago I used PyLab (a MatLab-like plotting module for > Python) on a Windows machine, but I don't know if there is a similar > easy-to-instal

Re: sine in python

2008-04-03 Thread zillow10
On Apr 3, 11:58 pm, Astan Chee <[EMAIL PROTECTED]> wrote: > Hi, > I have a math function that looks like this > sin (Theta) = 5/6 > How do I find Theta (in degrees) in python? I am aware of the math.sin > function, but is there a reverse? maybe a sine table in python? > Thanks > Astan > > -- > "For

Re: Manipulate Large Binary Files

2008-04-03 Thread Derek Martin
On Thu, Apr 03, 2008 at 02:36:02PM -0400, Derek Tracy wrote: > I am running it on a RAID(stiped raid 5 using fibre channel), but I > was expecting better performance. Don't forget that you're reading from and writing to the same spindles. Writes are slower on RAID 5, and you have to read the da

sine in python

2008-04-03 Thread Astan Chee
Hi, I have a math function that looks like this sin (Theta) = 5/6 How do I find Theta (in degrees) in python? I am aware of the math.sin function, but is there a reverse? maybe a sine table in python? Thanks Astan -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two."

Re: id functions of ints, floats and strings

2008-04-03 Thread Daniel Fetchinson
> Hi all, > > I've been playing around with the identity function id() for different > types of objects, and I think I understand its behaviour when it comes > to objects like lists and tuples in which case an assignment r2 = r1 > (r1 refers to an existing object) creates an alias r2 that refers to

Re: python bisect questions

2008-04-03 Thread John Machin
On Apr 4, 9:21 am, [EMAIL PROTECTED] wrote: > On Apr 3, 4:24 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > > > > > > > > <[EMAIL PROTECTED]> wrote in message > > >news:[EMAIL PROTECTED] > > |I am week on functional programming, and having hard time > > | understanding this: > > | > > | class myP

Re: id functions of ints, floats and strings

2008-04-03 Thread George Sakkis
[EMAIL PROTECTED] wrote: > 1) Which of the above behaviours are reliable? For example, does a1 = > a2 for ints and strings always imply that a1 is a2? No. > 2) From the programmer's perspective, are ids of ints, floats and > string of any practical significance at all (since these types are > im

Easy-to-install-and-use scientific graphics (plotting) package for Python 2.5.1 on Linux Ubuntu 7.1

2008-04-03 Thread Dr. Colombes
Is there an easy scientific graphics (plotting) package for Python 2.5.1 running on Ubuntu Linux 7.1 ("Gutsy Gibbon")? A few years ago I used PyLab (a MatLab-like plotting module for Python) on a Windows machine, but I don't know if there is a similar easy-to-install-and-use Python 2.5.1-compatibl

Re: Bug in shlex??

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 19:20:59 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > I'm trying to use shlex.split to simulate what would happen in the > shell. The docs say that it should be as close as possible to the > posix shell parsing rules. > > If you type the following into a posix co

Re: expanding a variable to a dict

2008-04-03 Thread Gary Herron
idle wrote: > brilliant. > Hardly. Any perceived brilliance is in the design of Python, not our simple and hopefully effective use of it. :-) Gary Herron > thanks to both of you. > -- http://mail.python.org/mailman/listinfo/python-list

Re: id functions of ints, floats and strings

2008-04-03 Thread zillow10
On Apr 3, 11:27 pm, [EMAIL PROTECTED] wrote: > Hi all, > > I've been playing around with the identity function id() for different > types of objects, and I think I understand its behaviour when it comes > to objects like lists and tuples in which case an assignment r2 = r1 > (r1 refers to an existi

id functions of ints, floats and strings

2008-04-03 Thread zillow10
Hi all, I've been playing around with the identity function id() for different types of objects, and I think I understand its behaviour when it comes to objects like lists and tuples in which case an assignment r2 = r1 (r1 refers to an existing object) creates an alias r2 that refers to the same o

Re: developing web spider

2008-04-03 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, John Nagle <[EMAIL PROTECTED]> wrote: > abeen wrote: > > Hello, > > > > I would want to know which could be the best programming language for > > developing web spider. > > More information about the spider, much better,, > > As someone who actually runs a Py

Re: expanding a variable to a dict

2008-04-03 Thread idle
brilliant. thanks to both of you. -- http://mail.python.org/mailman/listinfo/python-list

Re: expanding a variable to a dict

2008-04-03 Thread John Machin
On Apr 4, 8:56 am, idle <[EMAIL PROTECTED]> wrote: > I've got a variable in a loop that I'm trying to expand/translate/ > readdress as an existing dict so as to add some keys into it.. > > eg; I have a set of existing dicts: dictFoo, dictBar, dictFrotz (names > changed to protect the innocent) > >

Re: python bisect questions

2008-04-03 Thread ankitks . mital
On Apr 3, 4:24 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > |I am week on functional programming, and having hard time > | understanding this: > | > | class myPriorityQueue: > |      def __init__(self, f=lamda x:x): > |            

Bug in shlex??

2008-04-03 Thread [EMAIL PROTECTED]
I'm trying to use shlex.split to simulate what would happen in the shell. The docs say that it should be as close as possible to the posix shell parsing rules. If you type the following into a posix compliant shell echo '\?foo' you get back: \?foo (I've tested this in dash, bash and zsh---all

Re: expanding a variable to a dict

2008-04-03 Thread Arnaud Delobelle
On Apr 3, 10:56 pm, idle <[EMAIL PROTECTED]> wrote: > I've got a variable in a loop that I'm trying to expand/translate/ > readdress as an existing dict so as to add some keys into it.. > > eg; I have a set of existing dicts: dictFoo, dictBar, dictFrotz (names > changed to protect the innocent) > >

Re: expanding a variable to a dict

2008-04-03 Thread Gary Herron
idle wrote: > I've got a variable in a loop that I'm trying to expand/translate/ > readdress as an existing dict so as to add some keys into it.. > > eg; I have a set of existing dicts: dictFoo, dictBar, dictFrotz (names > changed to protect the innocent) > > now I'd like to check them all for the

expanding a variable to a dict

2008-04-03 Thread idle
I've got a variable in a loop that I'm trying to expand/translate/ readdress as an existing dict so as to add some keys into it.. eg; I have a set of existing dicts: dictFoo, dictBar, dictFrotz (names changed to protect the innocent) now I'd like to check them all for the existence of certain def

Re: State of ctypes Support on HP-UX?

2008-04-03 Thread Phil Thompson
On Thursday 03 April 2008, Thomas Heller wrote: > Phil Thompson schrieb: > > On Thursday 03 April 2008, Thomas Heller wrote: > >> Phil Thompson schrieb: > >> > Could somebody confirm how well ctypes is supported on HP-UX (for both > >> > PA-RISC and Itanium) for both Python v2.4 and v2.5? > >> > >>

Re: python bisect questions

2008-04-03 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |I am week on functional programming, and having hard time | understanding this: | | class myPriorityQueue: | def __init__(self, f=lamda x:x): | self.A = [] | self.f = f | | def append(self, item) |

Re: displaying execution of Python code

2008-04-03 Thread Stef Mientki
noahwatkins wrote: > I'll start my question by describing my desired result. I will > construct a GUI which will be used to open a Python script. I would > then like to be able to display the Python script, execute it, and > highlight the lines of the Python as they are executing. > > More technica

displaying execution of Python code

2008-04-03 Thread noahwatkins
I'll start my question by describing my desired result. I will construct a GUI which will be used to open a Python script. I would then like to be able to display the Python script, execute it, and highlight the lines of the Python as they are executing. More technically, I am looking for directio

Re: Python-by-example - new online guide to Python Standard Library

2008-04-03 Thread AK
AK wrote: > > I uploaded an updated site incorporating most of the suggestions I > received and fixing some errors along the way. I will be adding more > examples to modules that are already covered and will try to add more > modules during the following week. Thanks again to all who posted adv

Re: Classes in modules

2008-04-03 Thread hexusnexus
Yeah, I was a little embarrassed putting my code up to be examined. Thanks for the reply. I typed up some classes, but I seemed to have run into some more problems. One of the classes keeps getting an error that it can't pop from an empty list. Here's the code so far: begin ma

Re: object-relational mappers

2008-04-03 Thread M.-A. Lemburg
On 2008-04-01 22:40, Aaron Watters wrote: > I've been poking around the world of object-relational > mappers and it inspired me to coin a corellary to the > the famous quote on regular expressions: > > "You have objects and a database: that's 2 problems. > So: get an object-relational mapper: > no

Re: function call - default value & collecting arguments

2008-04-03 Thread Primoz Skale
"OKB (not okblacke)" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Primoz Skale wrote: > >> OK, everything allright till so fair. But! :) Now define third >> function as: >> >> def f(*a): >>print a[0] >> >> In this case, function only prints first argument in the tuple: >> >>>

Nonlinear least square problem

2008-04-03 Thread Uwe Kotyczka
Hallo, sorry for multiposting, but I am really looking for some hint to solve my problem. And no, I don't use Matlab, but maybe the matlab people have an idea nevertheless. I have to solve a nonlinear least square problem. Let me tell you some background first. Imagine you have a tool to process s

Re: Pexpect question.

2008-04-03 Thread Jorgen Grahn
On Wed, 02 Apr 2008 19:57:31 -0600, Paul Lemelle <[EMAIL PROTECTED]> wrote: > Jorgen, > > Thanks for your reply. > > The ssh function is just a small part of what I would like to > accomplish. And yes, chk is undefined, I was trying to figure out why > control was not being returned from the sshc

python bisect questions

2008-04-03 Thread ankitks . mital
I am week on functional programming, and having hard time understanding this: class myPriorityQueue: def __init__(self, f=lamda x:x): self.A = [] self.f = f def append(self, item) bisect.insort(self.A, (self.f(item), item)) n

Re: Efficient way of testing for substring being one of a set?

2008-04-03 Thread Pop User
[EMAIL PROTECTED] wrote: > Dennis Benzinger: >> You could use the Aho-Corasick algorithm > Aho-Corasick_algorithm>. >> I don't know if there's a Python implementation yet. > > http://hkn.eecs.berkeley.edu/~dyoo/python/ahocorasick/ > http://nicolas.lehuen.com/

Re: Python in High School

2008-04-03 Thread ajaksu
On Apr 2, 5:01 pm, John Henry <[EMAIL PROTECTED]> wrote: > However, once I start teaching him variables, expressions, loops, and > what not, I found that (by surprise) he had great difficulties > catching on.  Not soon after that, we had to quit. This makes me curious: how much of videogamer are y

Re: State of ctypes Support on HP-UX?

2008-04-03 Thread Thomas Heller
Phil Thompson schrieb: > On Thursday 03 April 2008, Thomas Heller wrote: >> Phil Thompson schrieb: >> > Could somebody confirm how well ctypes is supported on HP-UX (for both >> > PA-RISC and Itanium) for both Python v2.4 and v2.5? >> I cannot answer your question, but if you want to try it out >>

Re: Manipulate Large Binary Files

2008-04-03 Thread Derek Tracy
On Apr 3, 2008, at 3:03 AM, Paul Rubin <"http:// phr.cx"@NOSPAM.invalid> wrote: > Derek Martin <[EMAIL PROTECTED]> writes: >>> Both are clocking in at the same time (1m 5sec for 2.6Gb), are there >>> any ways I can optimize either solution? > > Getting 40+ MB/sec through a file system is pretty

Re: Python for low-level Windows programming

2008-04-03 Thread Troels Thomsen
>> >> Is this possible without too much pain? I know I can code it with C# >> or C++ but tha'ts a road to avoid, if possible. > > Well of course I don't know exactly what you'd need, but the > answer's certainly Yes :) Need I mention that it is also easy to write a windows service, using pyservic

Re: Manipulate Large Binary Files

2008-04-03 Thread Derek Tracy
--- Derek Tracy [EMAIL PROTECTED] --- On Apr 3, 2008, at 3:03 AM, Paul Rubin <"http:// phr.cx"@NOSPAM.invalid> wrote: > Derek Martin <[EMAIL PROTECTED]> writes: >>> Both are clocking in at the same time (1m 5sec for 2.6Gb), are there >>> any ways

Re: splitting an XML file on the basis on basis of XML tags

2008-04-03 Thread Diez B. Roggisch
> I abuse it because I can (and because I don't generally work with XML > files larger than 20-30meg) :) > And the OP never said the XML file for 1TB in size, which makes things > different. Even with small xml-files your advice was not very sound. Yes, it's tempting to use regexes to process xml

Re: Strange MySQL Problem...

2008-04-03 Thread Gabriel Genellina
En Thu, 03 Apr 2008 14:03:53 -0300, Victor Subervi <[EMAIL PROTECTED]> escribió: > On Thu, Apr 3, 2008 at 9:34 AM, Gabriel Genellina > <[EMAIL PROTECTED]> > wrote: > > Thank you. I believe you mean by bound, something like this, right? > binary(picdata) > I am now doing that, if I am not mista

Re: Python in High School

2008-04-03 Thread marion
On Apr 1, 1:27 pm, sprad <[EMAIL PROTECTED]> wrote: > I'm a high school computer teacher, and I'm starting a series of > programming courses next year (disguised as "game development" classes > to capture more interest). The first year will be a gentle > introduction to programming, leading to two

Re: Module not found in script that was found in command-line interpreter. Possible Path issue?

2008-04-03 Thread Trent Mick
Jacob Davis wrote: > I just installed the MySQLdb module and I have been able to get it to > run in my command line interpreter. > > I am running Mac Leopard, and Python 2.5. > > I have tested importing and actually connecting and using a MySQL > database, although it issues some warning: >

Re: Get all strings matching given RegExp

2008-04-03 Thread Paul McGuire
On Apr 3, 4:50 am, Alex9968 <[EMAIL PROTECTED]> wrote: > Can I get sequence of all strings that can match a given regular > expression? For example, for expression '(a|b)|(x|y)' it would be ['ax', > 'ay', 'bx', 'by'] > Actually, this regex will only match 'a', 'b', 'x', or 'y' (assuming you meant

Re: Python-by-example - new online guide to Python Standard Library

2008-04-03 Thread AK
AK wrote: > Hello, > > I find that I learn easier when I go from specific examples to a more > general explanation of function's utility and I made a reference guide > that will eventually document all functions, classes and methods in > Python's Standard Library. For now, I covered about 20 mo

Re: Python in High School

2008-04-03 Thread Stef Mientki
>> Well I doubt it's the visual environment that makes it more easy, >> color, shape and position can give some extra information though. >> I think apriori domain knowledge and flattness of information are of far >> more importance. >> The first issue is covered quit well by Robolab / Labview, >>

Re: Strange MySQL Problem...

2008-04-03 Thread Victor Subervi
On Thu, Apr 3, 2008 at 9:34 AM, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > En Thu, 03 Apr 2008 09:43:57 -0300, Victor Subervi > <[EMAIL PROTECTED]> escribió: > > >> Steve Holden wrote: > >> Define "no longer works". > > Sorry. Throws HTTP 200 error. > > HTTP 200 means OK. Yes. But there is a

Re: Why prefer != over <> for Python 3.0?

2008-04-03 Thread D'Arcy J.M. Cain
On Thu, 03 Apr 2008 05:12:28 GMT Tim Roberts <[EMAIL PROTECTED]> wrote: > Yes, indeed. In response to a challenge posted on one of the x86 assembler > newsgroups about two years ago, one intrepid Russian programmer produced a > generic Sudoku solver in a 65-byte executable. Yes, that's 65 BYTES -

Application of "with" statement in py3k. Property defining/redefining.

2008-04-03 Thread Zaur Shibzoukhov
http://szport.blogspot.com/2008/04/application-of-with-statement-in-py3k.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Directed Graph Traversal

2008-04-03 Thread bukzor
On Apr 2, 8:33 pm, Scott David Daniels <[EMAIL PROTECTED]> wrote: > bukzor wrote: > > Can someone point me in the direction of a good solution of this? I'm > > using it to construct a SQL query compiler, > > Given a directed graph and a list of points in the graph, what is the > > minimal subg

PyXMPP and GTalk

2008-04-03 Thread Ivan Chernetsky
Hello! Here is the example from PyXMPP package: http://pyxmpp.jajcus.net/trac/browser/trunk/examples/echobot.py And here is output: -- http://mail.python.org/mailman/listinfo/python-list

Re: object-relational mappers

2008-04-03 Thread Luis M . González
On 3 abr, 11:06, Bruno Desthuilliers wrote: > Luis M. González a écrit : > > > I have come to the same conclusion. > > ORMs make easy things easier, but difficult things impossible... > > Not my experience with SQLAlchemy. Ok, I still not had an occasion to > test it against stored procedures, but

Re: object-relational mappers

2008-04-03 Thread Luis M . González
Yes, webpy's db api can be used in stand-alone scripts if you want. See below: import web db = web.database(dbn='mysql', db='northwind', user='root') x = db.select('employees') ... Another good thing is that, since queries return Storage objects (similar to dictionaries), they are much more flexi

ANN: Leo 4.4.8 rc1 released

2008-04-03 Thread Edward K Ream
Leo 4.4.8 rc1 is now available at: http://sourceforge.net/project/showfiles.php?group_id=3458&package_id=29106 This version features a new ipython plugin that provides a two-way bridge between Leo and IPython. See http://webpages.charter.net/edreamleo/IPythonBridge.html Leo is a text editor, da

MLE in Python for distributions

2008-04-03 Thread Mike P
Hi All, Can anyone point me towards some code for Maximum Likilehood for distribution in python? Thanks Mike -- http://mail.python.org/mailman/listinfo/python-list

mailbox.Maildir(), confusing documentation

2008-04-03 Thread tinnews
Having got my Python 2.5.2 installed I'm trying some things out with the mailbox.Maildir() class. If I do the following:- import maibox mailbox.Maildir("/home/isbd/Mail/Li/pytest") then the pytest Maildir mailbox is created - which is great but isn't documented. If the above creates the

Looking for Agile Python Consulting

2008-04-03 Thread Ed Leafe
This isn't a specific job request, which is why I'm not placing it on the Python Job Board. Rather, I'm in the process of gathering information for an upcoming project, and I need to determine what resources, if any, are available in the Python community. We're in the plannin

Re: object-relational mappers

2008-04-03 Thread Diez B. Roggisch
Bruno Desthuilliers schrieb: > Jarek Zgoda a écrit : >> Bruno Desthuilliers napisał(a): >> >>> Now my own experience is that whenever I tried this approach for >>> anything non-trivial, I ended up building an "ad-hoc, >>> informally-specified bug-ridden slow implementation of half of " >>> SQLAlche

Re: Efficient way of testing for substring being one of a set?

2008-04-03 Thread Ant
On Apr 3, 2:27 pm, George Sakkis <[EMAIL PROTECTED]> wrote: ... > It's even prettier in 2.5: > > any(word in name for word in words) > > George And arguably the most readable yet! -- http://mail.python.org/mailman/listinfo/python-list

Re: How easy is it to install python as non-root user?

2008-04-03 Thread tinnews
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] a écrit : > > Does python install fairly easily for a non-root user? > > > > I have an ssh login account onto a Linux system that currently > > provides Python 2.4.3 and I'd really like to use some of the > > improvements in Python

Re: How easy is it to install python as non-root user?

2008-04-03 Thread Matt Nordhoff
[EMAIL PROTECTED] wrote: > Does python install fairly easily for a non-root user? > > I have an ssh login account onto a Linux system that currently > provides Python 2.4.3 and I'd really like to use some of the > improvements in Python 2.5.x. > > So, if I download the Python-2.5.2.tgz file is it

Re: Nested try...except

2008-04-03 Thread Duncan Booth
Carl Banks <[EMAIL PROTECTED]> wrote: > Perhaps the advent of with blocks will help reduce this error in the > future. Indeed, and to encourage its use I think this thread ought to include the 'with statement' form of the function: from __future__ import with_statement from contextlib import cl

  1   2   >