Re: Python & Go

2009-11-15 Thread Yoav Goldberg
On Sun, Nov 15, 2009 at 4:00 AM, Terry Reedy wrote: > Yoav Goldberg wrote: > > >> On Sun, Nov 15, 2009 at 12:10 AM, Terry Reedy > tjre...@udel.edu>> wrote: >> >>Paul Rubin wrote: >> >>Mark Chu-Carroll has a new post about Go: &

Re: Python & Go

2009-11-14 Thread Yoav Goldberg
On Sun, Nov 15, 2009 at 12:10 AM, Terry Reedy wrote: > Paul Rubin wrote: > > Mark Chu-Carroll has a new post about Go: >> >> >> http://scienceblogs.com/goodmath/2009/11/the_go_i_forgot_concurrency_an.php >> > > In a couple of minutes, I wrote his toy prime filter example in Python, > mostly from

classmethod inheritance

2007-12-12 Thread Yoav Goldberg
a syntax for this -- the first method I proposed is a neat hack, and the second is a workaround, but I wouldn't want the first method to be the official way of doing things, and I suspect there are some use cases that can not be implemented as nicely with the second method. Yoav -- h

for line in file('filename'):

2007-07-24 Thread Yoav Goldberg
I use the idiom "for line in file('filename'): do_something(line)" quite a lot. Does it close the opened file at the end of the loop, or do I have to explicitly save the file object and close it afterward? Yoav -- http://mail.python.org/mailman/listinfo/python-list

importing a module from a specific directory

2007-07-21 Thread Yoav Goldberg
#x27;import sys; sys.append('..');' on the top of each script is a bit awkward. Is there a neat clean way of achieving the code organization? How do you organize your code in such settings? Thanks, Yoav -- http://mail.python.org/mailman/listinfo/python-list

defaultdicts pickling

2007-07-14 Thread Yoav Goldberg
rks great, but now I can not pickle it. I could ofcourse used a real function and not a lambda, but this would make things (a) somewhat slower and (b) a bit ugly. Is there another way of achieving the same behaviour, that allow for pickling? Thanks, Yoav -- http://mail.python.org/mailman/listinfo/python-list

Re: close failed: [Errno 0] No error goes to stdout

2005-08-30 Thread Yoav
Steve Holden wrote: > Yoav wrote: > >> I run a Java command line program. The point is, that it's not the >> program that output this error message for sure. And I don't expect >> popen3() to catch and report errors. I just want to keep my screen >> ou

Re: close failed: [Errno 0] No error goes to stdout

2005-08-29 Thread Yoav
lip to the screen, after all as I understood it is supposed to capture STDERR and STDOUT, but maybe I didn' t understand it right (it's quite probable). Anyway anyway I can do such a thing? Thanks. Peter Hansen wrote: > Yoav wrote: > >> I use the following code to the console o

close failed: [Errno 0] No error goes to stdout

2005-08-28 Thread Yoav
I use the following code to the console output: def get_console(cmd): try: p_in, p_out, p_err = os.popen3(cmd) except: pass out_str = '' for obj in p_out: out_str = out_str + obj for obj in p_err:

Re: RE Despair - help required

2005-08-25 Thread Yoav
Thank you all guys. It seems like the simpler the solution, the more I am happy about it. Sorry, for the simple question, I am quite new to this lang. Cheers. Robert Kern wrote: > Yoav wrote: > >>Don't think it will do much good. I need to get them from a file and >>

Re: RE Despair - help required

2005-08-25 Thread Yoav
Don't think it will do much good. I need to get them from a file and extract the last folder in the path. For example: if I get "c:\dos\util" I want to extract the string "\util" Fredrik Lundh wrote: > "Yoav" wrote: > >>I am trying the foll

Re: RE Despair - help required

2005-08-25 Thread Yoav
Thanks guys. Issue solved. I am also going to give Microsoft a call about it. Any other issues you want me to raise while I am talking to them? Cheers. Robert Kern wrote: > Yoav wrote: > >>I am trying the following: >> >>re.search(r'\\[^"\\]+(?=("?$))&#x

Re: Getting rid of "close failed: [Errno 0] No Error" on Win32

2005-08-25 Thread Yoav
Ok , I tried: try: os.popen3(...) except: as someone suggested here. And on FreeBSD I don't get the error message, and it works great. However, on Win32 I do get the annoying message. Any idea why? And How I can make it go away? thanks. Yoav wrote: > I am using os.popen3 t

RE Despair - help required

2005-08-25 Thread Yoav
I am trying the following: re.search(r'\\[^"\\]+(?=("?$))', "c:\ret_files") and I get a return of NoneType, and I have no idea why. I know that I missing something here, but I really can't figure out why (I bet it's something obvious). I also tried this RE on KODOS and it works fine there, so

Getting rid of "close failed: [Errno 0] No Error" on Win32

2005-08-24 Thread Yoav
I am using os.popen3 to call a console process and get its output and stderr. However on Win32 (and not OS X) I also get the Errno message. It's printed to the screen, which I wish to keep clean. How can disable this notification? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Variables in REs

2005-08-24 Thread Yoav
Such a sweet and simple way. Thanks. tooper wrote: > Use os.sep to get / or \ or whatever character used to build pathes on > the os you're working on > -- http://mail.python.org/mailman/listinfo/python-list

Variables in REs

2005-08-24 Thread Yoav
Anyway to set variables in REs. Meaning: I have the RE re.compile(r'/[^/]*') for example and I want to use it on both Win32 machines and Unix machnes. Meaning tha tI need to be able to control the '/' before compiling. I want to create and if and decide what the system is and then put the right

Re: Uploading images to imageshack.us with Python

2005-08-22 Thread Yoav
I would love a script to upload images to Imageshack.us. Any chance you can post the latest version or email it to me? Thanks. Ricardo Sanchez wrote: > I forgot to add that I'm behind a proxy, but I think that is > irrelevant. > > If you are not behind a proxy replace this line: > > print post

Running multiple console processes and watching their output

2005-08-22 Thread Yoav
I need to run multiple console apps in the background and to watch their output. I have no idea if this is possible, and I don't even know where to start looking. The processes are watchers, meaning that they watch folders and mail boxes and do operations on items in them . Essentially these ar

RE vs. SRE

2005-08-21 Thread Yoav
What is the difference between the two? Which on is better to use and why? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: RE Question

2005-08-18 Thread Yoav
What is the difference between the RE module and the SRE one? Original Message From: Jorge Godoy <[EMAIL PROTECTED]> To: Subject: Re:RE Question Date: 18/8/2005 17:44 > Yoav wrote: > > >>I don't understand why the two REs produce a different result.

Re: RE Question

2005-08-18 Thread Yoav
Thanks, it seems like the first answer covers the second as well. Thank you. Jorge Godoy wrote: > Yoav wrote: > > >>I don't understand why the two REs produce a different result. I read >>the RE guide but still I can't seem to figure it out. >> >>

RE Question

2005-08-18 Thread Yoav
I don't understand why the two REs produce a different result. I read the RE guide but still I can't seem to figure it out. >>> t 'echo user=name password=pass path="/ret files"\r\n' >>> re.findall(r'(?<=\s)[^=]+=((?:".*")|(?:\S*))(?=\s)', t) ['name', 'pass', '"/ret files"'] >>> re.findall(r'(