Re: Python Pop Quiz

2007-06-02 Thread Tijs
C", agree or disagree? (four word maximum) Agree. Readable interface-based callbacks. (Is that 4 or 5 words?) > > Bonus: A rabbi walks into a bar while nursing a baby goat. He is > closely followed by a priest, and a Perl hacker. Explain. try: pass -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: file reading by record separator (not line by line)

2007-06-01 Thread Tijs
okup how to use it is larger than the time to implement the specialized version for the task at hand. -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: subexpressions

2007-06-01 Thread Tijs
assumption even in a > dynamic language like Python. No, x may be an object that has the __mul__ special method, and it may have side effects. -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: file reading by record separator (not line by line)

2007-06-01 Thread Tijs
gle one that takes a wide range of construction possibilities, like strings, lambdas or regexes in various keyword parameters. BlockReader(f, start='>') BlockReader(f, start=re.compile('>|<'), end='---') BlockReader(f, start=lambda x: x.startswith(&#x

Re: file reading by record separator (not line by line)

2007-06-01 Thread Tijs
;') for block in b: # whatever -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: Roundup, smtplib, TLS and MS Exchange

2007-06-01 Thread Tijs
st I think this must be an issue with roundup, issuing commands in the wrong order. The correct order should (according to the rfc and the python docs) be: * ehlo() * starttls() * ehlo() * login() ... -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: file reading by record separator (not line by line)

2007-05-31 Thread Tijs
print lines > print > name=line.stripr('\r') > lines=[] > else: > lines.append(line.stripr('\n')) > That would miss the last chunk. -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: file reading by record separator (not line by line)

2007-05-31 Thread Tijs
tringIO s = \ """> name1 line1 line2 line3 > name2 line 4 line 5 line 6""" f = StringIO(s) for name, lines in chunkreader(f): print '***', name print ''.join(lines) $ python test.py *** name1 line1 line2 line3 *** name2 line 4 line 5 line 6 -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: non standard path characters

2007-05-31 Thread Tijs
ge, in which case you have no way of knowing. -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: c[:]()

2007-05-30 Thread Tijs
for i in c] # too long and ...huh? > a > b > [None,None] > #-- > [None, None] is the result of the operation. for i in c: i() If that is too long, reconsider what you are doing. -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: Anyone else has seen "forrtl: error (200) ..."

2007-05-30 Thread Tijs
g your SIGINT signal handler. Python installs an OS-level signal handler that raises the KeyboardInterrupt in the main thread. If a library installs its own handler, Python won't catch it. -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: How can an Exception pass over an "except" clause ?

2007-05-30 Thread Tijs
Ruben The 'raise' in line 1271 re-raises the last error instead of the exception in whose block it is called. This: try: raise KeyError except: try: raise IndexError except: pass raise raises IndexError, not KeyError. -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: How to print this character u'\u20ac' to DOS terminal

2007-05-30 Thread Tijs
ode, best to keep all text in unicode. -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: xmlrpclib hangs execution

2007-05-30 Thread Tijs
nection after having sent the response. Why the difference? Don't know, but it is something server-side. Try to force the server to send HTTP/1.0 responses, or turn off keep-alive, or something like that. Otherwise, adapt xmlrpclib.py to robustly handle 1.1 responses. -- Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: Scope - import and globals

2007-05-30 Thread Tijs
bles of other modules are properties of the module, use .. > > Also, functions in this file and in the imported parent class need > PyHttpTestCase. Does there need to be an import statement in both > files? Yes. Don't worry, the work is done only once. Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list

Re: How to print this character u'\u20ac' to DOS terminal

2007-05-30 Thread Tijs
ur application handles text, it may be easier to just leave everything in Unicode and encode to utf-8 for storage? Regards, Tijs -- http://mail.python.org/mailman/listinfo/python-list