Re: ssl: add msg_callback

2012-07-25 Thread Chris Rebert
On Wed, Jul 25, 2012 at 8:47 PM, Thiébaud Weksteen wrote: > > Hi python-list, > > I wrote a patch for Python 3.2.3 to expose the function > SSL_CTX_set_msg_callback in the module _ssl. > > I was actually surprise this function was not already in the > standard library as it is really handy: Well,

ssl: add msg_callback

2012-07-25 Thread Thiébaud Weksteen
Hi python-list, I wrote a patch for Python 3.2.3 to expose the function SSL_CTX_set_msg_callback in the module _ssl. I was actually surprise this function was not already in the standard library as it is really handy: "SSL_CTX_set_msg_callback() or SSL_set_msg_callback() can be used to define a

Re: from future import pass_function

2012-07-25 Thread Michael Hrivnak
If we want pass(), then why not break() and continue()? And also def() and class()? for(), while(), if(), with(), we can make them all callable objects! Except that they are control statements. They are not objects, they have no type, and they can never be evaluated in an expression. And most

Re: from future import pass_function

2012-07-25 Thread Rusi
Ulrich: If you take a look at pep 3105 you find five rationales. http://www.python.org/dev/peps/pep-3105/#rationale If the first were the only one then your suggestion would have merit. There are also the other 4 in which pass and print dont really correspond. Steven wrote earlier: > I have an ax

Re: from future import pass_function

2012-07-25 Thread Ethan Furman
Ross Ridge wrote: Ross Ridge wrote: No, they're very much alike. That's why all your arguments for print as function also apply just as well to pass a function. Your arguments had very little to do what what print actually did. Chris Angelico wrote: Except that print / print() is executa

Re: from future import pass_function

2012-07-25 Thread alex23
On Jul 26, 1:30 pm, Ross Ridge wrote: > No, they're very much alike. Repetition isn't evidence. You keep making this claim, so support it. > That's why all your arguments for print > as function also apply just as well to pass a function.  Your arguments > had very little to do what what print a

Re: from future import pass_function

2012-07-25 Thread alex23
On Jul 26, 11:42 am, Ross Ridge wrote: > Remember everything you've said about why its a good thing the that > print statement is now a function?  That. You regularly have the need to override the behaviour of pass? Are you _really_ saying you see no distinction between an application- level fun

Re: from future import pass_function

2012-07-25 Thread Ross Ridge
Ross Ridge wrote: > No, they're very much alike. That's why all your arguments for print > as function also apply just as well to pass a function. Your arguments > had very little to do what what print actually did. Chris Angelico wrote: >Except that print / print() is executable. Execution p

Re: from future import pass_function

2012-07-25 Thread Chris Angelico
On Thu, Jul 26, 2012 at 1:30 PM, Ross Ridge wrote: > Steven D'Aprano wrote: >>I can't believe I actually have to point this out explicitly, but pass is >>not print. Apart from them both starting with the letter "P", they are >>nothing alike. There are good reasons for making print a function, an

Re: from future import pass_function

2012-07-25 Thread Ross Ridge
Steven D'Aprano wrote: >What's the point of this? Ross Ridge wrote: > Remember everything you've said about why its a good thing the that > print statement is now a function? That. Steven D'Aprano wrote: >I can't believe I actually have to point this out explicitly, but pass is >not print.

Re: append in IMAP4 from imaplib very slow

2012-07-25 Thread Tim Chase
On 07/25/12 12:47, Simon Pirschel wrote: > I'm currently experimenting with IMAP using Python 2.7.3 and > IMAP4 from imaplib. I noticed the performance to be very bad. I > read 5000 files from a directory and append them to an IMAP > INBOX. The hole procedure of reading and appending is taking > ab

Re: from future import pass_function

2012-07-25 Thread Ross Ridge
Ulrich Eckhardt wrote: > I just had an idea, it occurred to me that the pass statement is pretty > similar to the print statement, [...] > try: > do_something() > except: > pass() Steven D'Aprano wrote: >What's the point of this? Remember everything you've said about wh

Re: append in IMAP4 from imaplib very slow

2012-07-25 Thread Antoine Pitrou
Simon Pirschel abusix.org> writes: > > Hi, > I'm currently experimenting with IMAP using Python 2.7.3 and IMAP4 > from imaplib. I noticed the performance to be very bad. I read 5000 > files from a directory and append them to an IMAP INBOX. The hole > procedure of reading and

Re: HMM and CRF Package

2012-07-25 Thread Terry Reedy
On 7/25/2012 11:58 AM, subhabangal...@gmail.com wrote: > As most of the libraries give so many bindings and conditions best way is to make it. Not very tough, I made earlier, but as some files were lost so was thinking instead of a remake if ready versions work. Or may look change from Python 3 t

Re: catch UnicodeDecodeError

2012-07-25 Thread Dave Angel
On 07/25/2012 08:09 AM, jaroslav.dob...@gmail.com wrote: > On Wednesday, July 25, 2012 1:35:09 PM UTC+2, Philipp Hagemeister wrote: >> Hi Jaroslav, >> >> you can catch a UnicodeDecodeError just like any other exception. Can >> you provide a full example program that shows your problem? >> >> This w

Re: from future import pass_function

2012-07-25 Thread Devin Jeanpierre
On Wed, Jul 25, 2012 at 2:14 PM, Ian Kelly wrote: > You can already use pass (or the equivalent) in a lambda. > > lambda: None This lacks my foolish consistency. -- Devin -- http://mail.python.org/mailman/listinfo/python-list

Re: from future import pass_function

2012-07-25 Thread Ian Kelly
On Jul 25, 2012 10:51 AM, "Devin Jeanpierre" wrote: > True. But it might be nice to use pass both in lambdas and regular > functions, or to use pass as a variable name. You can already use pass (or the equivalent) in a lambda. lambda: None -- http://mail.python.org/mailman/listinfo/python-list

append in IMAP4 from imaplib very slow

2012-07-25 Thread Simon Pirschel
Hi, I'm currently experimenting with IMAP using Python 2.7.3 and IMAP4 from imaplib. I noticed the performance to be very bad. I read 5000 files from a directory and append them to an IMAP INBOX. The hole procedure of reading and appending is taking about 210 seconds. I set up the exact same

Re: from future import pass_function

2012-07-25 Thread Devin Jeanpierre
On Wed, Jul 25, 2012 at 12:05 PM, Chris Angelico wrote: > Simple way of making the iterator display its yielded result. I cannot > imagine any circumstance in which you'd want to map "pass" over > everything. But then, as Teresa said, I'm only one, and possibly I'm > wrong! True. But it might be

Re: from future import pass_function

2012-07-25 Thread Ethan Furman
Ulrich Eckhardt wrote: I just had an idea, it occurred to me that the pass statement is pretty similar to the print statement, and similarly to the print() function, there could be a pass() function that does and returns nothing. Example: def pass(): return try: do_somethi

Re: from future import pass_function

2012-07-25 Thread Chris Angelico
On Wed, Jul 25, 2012 at 6:40 PM, Ulrich Eckhardt wrote: > I just had an idea, it occurred to me that the pass statement is pretty > similar to the print statement, and similarly to the print() function, there > could be a pass() function that does and returns nothing. > > Example: >def pass():

Re: HMM and CRF Package

2012-07-25 Thread subhabangalore
On Tuesday, July 24, 2012 9:09:02 PM UTC+5:30, (unknown) wrote: > Dear Group, > > I was looking for the following solutions. > > (i) a Python Hidden Markov Model(HMM) library. > (ii)a Python Conditional Random Field(CRF) library. > (iii) I am using Python 3.2.1 on Windows 7(64 bit) and also like

Re: Dumping all the sql statements as backup

2012-07-25 Thread andrea crotti
2012/7/25 Jack Since you know the content of what the sql code is, why not just build > the sql file(s) needed and store them so that in case of a burp you can > just execute the code file. If you don't know the exact sql code, dump > it to a file as the statements are constructed... The only prob

Re: Dumping all the sql statements as backup

2012-07-25 Thread Jack
On 07/25/2012 09:56 AM, andrea crotti wrote: > I have some long running processes that do very long simulations which > at the end need to write things on a database. > > At the moment sometimes there are network problems and we end up with > half the data on the database. > > The half-data problem

Dumping all the sql statements as backup

2012-07-25 Thread andrea crotti
I have some long running processes that do very long simulations which at the end need to write things on a database. At the moment sometimes there are network problems and we end up with half the data on the database. The half-data problem is probably solved easily with sessions and sqlalchemy (

Re: catch UnicodeDecodeError

2012-07-25 Thread jaroslav . dobrek
On Wednesday, July 25, 2012 1:35:09 PM UTC+2, Philipp Hagemeister wrote: > Hi Jaroslav, > > you can catch a UnicodeDecodeError just like any other exception. Can > you provide a full example program that shows your problem? > > This works fine on my system: > > > import sys > open('tmp', 'wb').

Re: catch UnicodeDecodeError

2012-07-25 Thread Philipp Hagemeister
Hi Jaroslav, you can catch a UnicodeDecodeError just like any other exception. Can you provide a full example program that shows your problem? This works fine on my system: import sys open('tmp', 'wb').write(b'\xff\xff') try: buf = open('tmp', 'rb').read() buf.decode('utf-8') except Uni

Re: catch UnicodeDecodeError

2012-07-25 Thread Andrew Berg
On 7/25/2012 6:05 AM, jaroslav.dob...@gmail.com wrote: > What I really want to do is use something like > > try: > # open file, read line, or do something else, I don't care > except UnicodeDecodeError: > sys.exit("Found a bad char in file " + file + " line " + str(line_number) > > Yet, n

Re: from future import pass_function

2012-07-25 Thread Steven D'Aprano
On Wed, 25 Jul 2012 10:40:45 +0200, Ulrich Eckhardt wrote: > Hi! > > I just had an idea, it occurred to me that the pass statement is pretty > similar to the print statement, [...] > try: > do_something() > except: > pass() What's the point of this? If you intend to do n

catch UnicodeDecodeError

2012-07-25 Thread jaroslav . dobrek
Hello, very often I have the following problem: I write a program that processes many files which it assumes to be encoded in utf-8. Then, some day, I there is a non-utf-8 character in one of several hundred or thousand (new) files. The program exits with an error message like this: UnicodeDec

Re: from future import pass_function

2012-07-25 Thread Devin Jeanpierre
On Wed, Jul 25, 2012 at 4:40 AM, Ulrich Eckhardt wrote: > What do you think? retort: def foo(): None -- Devin -- http://mail.python.org/mailman/listinfo/python-list

Re: reloading code and multiprocessing

2012-07-25 Thread andrea crotti
2012/7/23 Chris Angelico : > > That would probably be correct. However, I still think you may be > fighting against the language instead of playing to its strengths. > > I've never fiddled with sys.modules like that, but I know some have, > without problem. > > ChrisA > -- > http://mail.python.org/

Re: from future import pass_function

2012-07-25 Thread Nicholas Cole
On Wed, Jul 25, 2012 at 9:40 AM, Ulrich Eckhardt wrote: > What do you think? > I enjoyed the question, but actually I don't think this is a good idea. 1. If you really needed something like this, you could define it easily. def do_nothing(*args, **keywords): return None 2. If it were a bui

Re: from future import pass_function

2012-07-25 Thread Philipp Hagemeister
Unlike the print statement, pass has no overboarding complexity (like >>, printing tuples, etc.) - it just serves as a marker (and practicality beats purity). And you don't ever want to use pass as a value (say, for map() or the right side of an assignment). In fact, if pass were a function, users

Re: Python 2.6 StreamReader.readline()

2012-07-25 Thread wxjmfauth
On Wednesday, July 25, 2012 11:02:01 AM UTC+2, Walter Dörwald wrote: > On 25.07.12 08:09, Ulrich Eckhardt wrote: > > > Am 24.07.2012 17:01, schrieb cpppw...@gmail.com: > >> reader = codecs.getreader(encoding) > >> lines = [] > >> with open(filename, 'rb') as f: > >> lines

Re: Python 2.6 StreamReader.readline()

2012-07-25 Thread Walter Dörwald
On 25.07.12 08:09, Ulrich Eckhardt wrote: Am 24.07.2012 17:01, schrieb cpppw...@gmail.com: reader = codecs.getreader(encoding) lines = [] with open(filename, 'rb') as f: lines = reader(f, 'strict').readlines(keepends=False) where encoding == 'utf-16-be' Everything wo

from future import pass_function

2012-07-25 Thread Ulrich Eckhardt
Hi! I just had an idea, it occurred to me that the pass statement is pretty similar to the print statement, and similarly to the print() function, there could be a pass() function that does and returns nothing. Example: def pass(): return try: do_something() except:

Re: the meaning of rユ.......ï¾

2012-07-25 Thread Mark Lawrence
On 25/07/2012 07:43, Ben Finney wrote: Mark Lawrence writes: Any civil engineers reading this who would find 22/7 perfectly adequate for their task? Civil engineering? Pffft, that deals with only a few orders of magnitude range at most. “π is roughly 3” is usually good enough in that arena :