Re: A problem about File path encode

2006-10-10 Thread Gabriel G
At Tuesday 10/10/2006 11:32, Kevien Lee wrote: I agree with the problem caue of the the escape character,but when i folllow these meth,it still didn't work. Explain "didn't work". A full traceback would be useful. It is so strang that the code work on another computer (OS is WinXP),but throw

Re: "best" rational number library for Python?

2006-10-31 Thread Gabriel G
At Tuesday 31/10/2006 21:16, [EMAIL PROTECTED] wrote: casevh> You must use "gmake". "make" fails during "make check" Very weird: piggy:% make -v GNU Make 3.80 piggy:% gmake -v GNU Make 3.80 Nevertheless, using "gmake" instead of "make" did indeed work. Thanks for the hint

Re: unpickling Set as set

2006-11-08 Thread Gabriel G
At Wednesday 8/11/2006 05:26, George Sakkis wrote: Or you may have this done automatically by hacking the Set class: from sets import Set import cPickle as pickle Set.__reduce__ = lambda self: (set, (self._data,)) s = Set([1,2,3]) x = pickle.dumps(s) print pickle.loads(x) This doesn't work

Re: is this the right way to do subclasses?

2006-11-08 Thread Gabriel G
At Wednesday 8/11/2006 16:33, John Salerno wrote: > class Character(object): > def __init__(self, name, strength, dexterity, intelligence): > self.name = name > self.health = 10 > self.strength = strength > self.dexterity = dexterity > self.intelligenc

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 """ > > [...] > > """ > > You're printing a string, and never using th

Re: lazy arithmetic

2006-08-24 Thread Gabriel G
At Friday 25/8/2006 02:18, [EMAIL PROTECTED] wrote: > x+y get translated to x.__add__(y) No that's not true at all. The self argument to __add__ ends up being the Add instance, not the Item instance: z=x+y is translated to z.__add__(y) Well, I deleted my response after I noticed that Simon

Re: question about class, functions and scope

2006-08-28 Thread Gabriel G
At Saturday 26/8/2006 06:13, nephish wrote: i have an app that runs three classes as threads in the same program. some of them need to be able to share some functions. Can i set a function before i define a class and have the class use it ? Kinda like this. def some_function(var1, var2): do

Re: a question about my script

2006-08-31 Thread Gabriel G
At Thursday 31/8/2006 10:01, alper soyler wrote: I changed the script as you wrote below: directory = 'pub/kegg/genomes' Sorry, in the original comment I said "change it to be an absolute path" but didn't write it well. This line should read: directory = '/pub/kegg/genomes' Gabriel Gene

Re: a question about ftplib

2006-09-01 Thread Gabriel G
At Friday 1/9/2006 06:32, alper soyler wrote: Thank you very much for your help. The program works however, after downloading 121 '.pep' files, it gave me time out error: Traceback (most recent call last): File "ftp1.0.py", line 18, in ? for filename in ftp.nlst(): ... File "/usr/lib

Re: A critique of cgi.escape

2006-09-25 Thread Gabriel G
At Monday 25/9/2006 11:08, Jon Ribbens wrote: >> What precisely do you think it would "break"? > > existing code, and existing tests. I'm sorry, that's not good enough. How, precisely, would it break "existing code"? Can you come up with an example, or even an explanation of how it *could* brea

Re: A critique of cgi.escape

2006-09-26 Thread Gabriel G
At Tuesday 26/9/2006 04:16, Lawrence D'Oliveiro wrote: >> >> What precisely do you think it would "break"? > FWIW, a *lot* of unit tests on *my* generated html code would break... Why did you write your code that way? Uhm, maybe because I relied on the published documentation of a published s

Re: A critique of cgi.escape

2006-09-26 Thread Gabriel G
At Tuesday 26/9/2006 12:53, Jon Ribbens wrote: > BTW, I am curious about how you do unit testing. The example that I used > in my summary is a very common pattern but would break in cgi.escape > changed it's semantics. What do you do instead? To be honest I'm not sure what *sort* of code people

Re: Questions on Using Python to Teach Data Structures and Algorithms

2006-09-28 Thread Gabriel G
At Thursday 28/9/2006 12:23, Ramon Diaz-Uriarte wrote: Going back to the original question, a related question: does anybody know why there are so few books on data structures and algorithms that use Python? I remember that, at least ~ 12 years ago there were many (and very good) books that use

Re: where the extra space comes from on the stdout

2006-10-02 Thread Gabriel G
At Saturday 30/9/2006 19:09, Steve Holden wrote: > while 1: > print 'Question [Y/[N]]?', > if sys.stdin.readline().strip() in ('Y','y'): > #do something > pass > > $ python q.py > Question [Y/[N]]?y > Question [Y/[N]]?y > Question [Y/[N]]?y > Yup. When you execute

Re: saving an exception

2006-10-03 Thread Gabriel G
At Tuesday 3/10/2006 02:15, Bryan wrote: >i would like to save an exception and reraise it at a later time. >def foo(): >Â Â try: >Â Â Â Â 1/0 >Â Â except Exception, e: >Â Â Â Â exception = e > >if exception: raise exception > >with the above code, i'm able to successfully raise the ex

Re: Howto pass Array/Hash into Function

2006-10-03 Thread Gabriel G
At Tuesday 3/10/2006 06:05, Wijaya Edward wrote: How can I pass Array, Hash, and a plain variable in to a function at the same time. I come from Perl. Where as you probably know it is done like this: sub myfunc { my ($plain_var, $hash_ref,$arref) = @_; # Do sth with those variables

Re: PEP 358 and operations on bytes

2006-10-03 Thread Gabriel G
At Tuesday 3/10/2006 21:52, Ben Finney wrote: Gerrit Holl <[EMAIL PROTECTED]> writes: > operations that aren't currently defined in PEP 358, like: > > - str methods endswith, find, partition, replace, split(lines), > startswith, > - Regular expressions > > I think those can be use

Re: Python Question About Compiling.

2006-11-29 Thread Gabriel G
At Thursday 30/11/2006 03:40, Scheol Service wrote: i know this. Is there better directions on how to use it? Have you tried it? What's your actual problem? See http://www.py2exe.org/ -- Gabriel Genellina Softlab SRL __ Correo Yahoo! Espacio

Re: One detail...

2006-12-01 Thread Gabriel G
At Saturday 2/12/2006 00:40, [EMAIL PROTECTED] wrote: I'm trying to do in Zope, which doesn't allow "_" characters at the beginning of identifiers. Even in an external method, it gives me an error when I try to reference the o.a. Is there a trick to do it some other way? Better to ask on a Z