Re: Splitting a string into substrings of equal size

2009-08-15 Thread Rascal
I'm bored for posting this, but here it is: def add_commas(str): str_list = list(str) str_len = len(str) for i in range(3, str_len, 3): str_list.insert(str_len - i, ',') return ''.join(str_list) -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest

2009-08-15 Thread Richard Thomas
On Aug 15, 4:28 am, Mag Gam magaw...@gmail.com wrote: I am writing an application which has many command line arguments. For example: foo.py -args bar bee I would like to create a test suit using unittest so when I add features to foo.py I don't want to break other things. I just heard about

Re: Natural Language Processing in Python

2009-08-15 Thread Alejandro E. Ciniglio
nltk is a good start, we used it in my Computational Linguistics course in school. www.nltk.org --Alejandro -- http://mail.python.org/mailman/listinfo/python-list

Re: Natural Language Processing in Python

2009-08-15 Thread Ned Deily
In article be976afb-fe4b-4e12-9a46-9977832fe...@13g2000prl.googlegroups.com, Prateek prateekkakir...@gmail.com wrote: Can somebody please provide me link to a good online resource or e- book for doing natural language processing programming in Python. Check out the Natural Language Toolkit:

Re: Natural Language Processing in Python

2009-08-15 Thread Vlastimil Brom
2009/8/14 Prateek prateekkakir...@gmail.com: Hi, Can somebody please provide me link to a good online resource or e- book for doing natural language processing programming in Python. Thanks, Prateek -- http://mail.python.org/mailman/listinfo/python-list Maybe you could start with NLTK

bug?: python-config --ldflags gives incorrect output

2009-08-15 Thread Joseph Garvin
On the latest stable ubuntu: $ python-config --ldflags -L/usr/lib/python2.6/config -lpthread -ldl -lutil -lm -lpython2.6 In case the user is statically linking, I believe the -lpython2.6 should go before the other -l's. Also, -lz is missing so whenever you try to link against python you get tons

Re: A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-15 Thread fortunatus
On Aug 14, 1:01 pm, vippstar vipps...@gmail.com wrote: Why would you fill your website with junk? The OP made it clear: Just wanted to express some frustration with whitespace-mode. -- http://mail.python.org/mailman/listinfo/python-list

get the pause status from amarok 2.1

2009-08-15 Thread Sleepy Cabbage
As the title says, I'm trying to find a way to get the pause status from amarok 2.1. I'm running kubuntu 9.04 with kde 4.2.2, python 2.6.2. Thanks in advance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Natural Language Processing in Python

2009-08-15 Thread wwwayne
On Fri, 14 Aug 2009 09:31:43 -0700 (PDT), Prateek prateekkakir...@gmail.com wrote: Hi, Can somebody please provide me link to a good online resource or e- book for doing natural language processing programming in Python. Thanks, Prateek http://www.nltk.org/book --

Re: anyone with genomewide microarray analysis experience ?

2009-08-15 Thread Istvan Albert
On Aug 14, 8:52 am, trias t.gkikopou...@dundee.ac.uk wrote: Does anyone have some scripts I could use for this purpose. I work with S.cerevisiae Since the largest chromosome on the yeast genome is around 4 million bp, the easiest way to accomplish your goal is to create a list of the same size

Re: Python 'for' loop is memory inefficient

2009-08-15 Thread Rascal
look at xrange -- http://docs.python.org/library/functions.html#xrange -- http://mail.python.org/mailman/listinfo/python-list

Re: A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-15 Thread Martin P. Hellwig
Sounds like a bad case of STRIS http://blog.dcuktec.com/2009/08/stris.html -- http://mail.python.org/mailman/listinfo/python-list

Re: Why does my ftp script quit after couple of hours?

2009-08-15 Thread kk
Awesome stuff, thank you so much for all the help. The Pcomp.lang.python is the most helpful list I have encountered so far :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Natural Language Processing in Python

2009-08-15 Thread mobiledreamers
Try this out Fotoroll does term extraction http://bit.ly/HCPDi So to get json output of list of terms post to http://fotoroll.com/findterms?json=truetext=Content+to+extract terms from Hope this helps Fotoroll Term extraction No limit on number of queries per day Yahoo 5000 queries a day

Re: implementing descriptors

2009-08-15 Thread Raymond Hettinger
Raymond,    This functionality is exactly what I was looking for. Thanks!  I'll be using this to solve my problem.    Now that I'm on the right track, I'm still a bit confused about how __get__ and __set__ are useful.  Admittedly, I don't need to understand them to solve this problem, but

for cycle with assigning index

2009-08-15 Thread dmitrey
Hi all, could you inform me how to do it properly? I have the cycle for i in xrange(len(Funcs2)): # Funcs2 is Python dict Funcs.append(lambda *args, **kwargs: (Funcs2[i](*args, **kwargs) [IndDict[left_arr_indexes[i]]])) So, all the Funcs are initialized with i = last index = len(Funcs2)

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 15:58:37 exar...@twistedmatrix.com wrote: One strategy you might employ to get rid of the busy looping is to use Twisted and its serial port support. This also addresses the full- duplex issue you've raised. I know - vaguely - about twisted and I have been dancing

Re: for cycle with assigning index

2009-08-15 Thread Carl Banks
On Aug 15, 12:17 am, dmitrey dmitrey.kros...@scipy.org wrote: Hi all, could you inform me how to do it properly? I have the cycle for i in xrange(len(Funcs2)): # Funcs2 is Python dict      Funcs.append(lambda *args, **kwargs: (Funcs2[i](*args, **kwargs) [IndDict[left_arr_indexes[i]]]))

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:19:04 Grant Edwards wrote: On 2009-08-14, Hendrik van Rooyen hend...@microcorp.co.za wrote: In the meantime I have had another idea which I have also not tried yet, namely to do independent opens for reading and writing, to give me two file instances instead of

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:03:22 Diez B. Roggisch wrote: You should *really* just use pyserial. No hassle, instant satisfaction. :-) I have downloaded and had a quick look, and I see it is based on the standard library's serial.Serial class - another battery that I have not used before.

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:19:36 Grant Edwards wrote: On 2009-08-14, exar...@twistedmatrix.com exar...@twistedmatrix.com wrote: One strategy you might employ to get rid of the busy looping is to use Twisted and its serial port support. This also addresses the full- duplex issue you've

Re: for cycle with assigning index

2009-08-15 Thread Paul Rubin
Carl Banks pavlovevide...@gmail.com writes: def create_funcs_caller(i): def func(*args,**kwargs): return(Funcs2[i](*args,**kwargs)[IndDict[left_arr_indexes[i]]]) retirm func for i in xrange(len(Funcs2)): Funcs.append(create_funcs_caller(i)) I prefer to get rid of the

Re: A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-15 Thread Xah Lee
Fresh out of the oven: • How to use and setup Emacs's whitespace-mode http://xahlee.org/emacs/whitespace-mode.html Xah ∑ http://xahlee.org/ ☄ On Aug 13, 6:36 pm, Xah Lee xah...@gmail.com wrote: • A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 16:28:26 Grant Edwards wrote: On 2009-08-14, greg g...@cosc.canterbury.ac.nz wrote: Hendrik van Rooyen wrote: 8--- Doh! It didn't even occur to me that somebody would use python file objects for serial

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 18:11:52 Steven D'Aprano wrote: On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: I saw `cout' being shifted Hello world times to the left and stopped right there. --Steve Gonedes Assuming that's something real, and not invented for humour, I presume that's

Re: Python docs disappointing - group effort to hire writers?

2009-08-15 Thread Carl Banks
On Aug 14, 10:15 pm, Bill Jones oracleb...@gmail.com wrote: On Aug 8, 3:27 pm, Mark Lawrence breamore...@yahoo.co.uk wrote: My gut feeling (which could of course be wrong) is that many hard core Pythonistas are cheesed off with newbies who refuse to help themselves. The funny thing is that

Re: Why does my ftp script quit after couple of hours?

2009-08-15 Thread Hendrik van Rooyen
On Friday 14 August 2009 18:25:50 kk wrote: As far as robustness, I agree with your assestment. I guess my main confusion with my result is that the console window just disappears. I wonder if I can make the window stay even if it crashesor if there are connection issues? I will createa

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-15 Thread Chris Rebert
On Sat, Aug 15, 2009 at 4:47 AM, Hendrik van Rooyenhend...@microcorp.co.za wrote: On Friday 14 August 2009 18:11:52 Steven D'Aprano wrote: On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: I saw `cout' being shifted Hello world times to the left and stopped right there.  --Steve Gonedes

Re: Python 'for' loop is memory inefficient

2009-08-15 Thread Hendrik van Rooyen
On Saturday 15 August 2009 03:25:45 Dr. Phillip M. Feldman wrote: It seems as though Python is actually expanding range(2,n) into a list of numbers, even though this is incredibly wasteful of memory. There should be a looping mechanism that generates the index variable values incrementally as

Re: Python 'for' loop is memory inefficient

2009-08-15 Thread John Machin
On Aug 15, 11:38 am, Mark Lawrence breamore...@yahoo.co.uk wrote: Dr. Phillip M. Feldman wrote: I wrote the following correct but inefficient test of primality for purposes of demonstrating that the simplest algorithm is often not the most efficient.  But, when I try to run the following

Re: get the pause status from amarok 2.1

2009-08-15 Thread Sleepy Cabbage
On Fri, 14 Aug 2009 12:55:07 +0200, Diez B. Roggisch wrote: Sleepy Cabbage schrieb: As the title says, I'm trying to find a way to get the pause status from amarok 2.1. I'm running kubuntu 9.04 with kde 4.2.2, python 2.6.2. Thanks in advance. Not at my linux-system right now, but dcop

Re: A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-15 Thread Byung-Hee HWANG
Xah Lee xah...@gmail.com writes: • A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode http://xahlee.org/UnixResource_dir/writ/emacs_whitespace-mode_problems.html [... snip 38 lines ...] OK, Xah, thanks for good writing, i'll read it 27 hours later. And i respect for your

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Saturday 15 August 2009 04:03:42 Terry Reedy wrote: greg wrote: You can't read and write with the same stdio file object at the same time. Odd things tend to happen if you try. I believe the C standard specifies that the behavior of mixed reads and writes is undefined without

Re: unittest

2009-08-15 Thread Mag Gam
So, in this example: import random In my case I would do import foo ? is there anything I need to do for that? On Sat, Aug 15, 2009 at 2:24 AM, Richard Thomaschards...@gmail.com wrote: On Aug 15, 4:28 am, Mag Gam magaw...@gmail.com wrote: I am writing an application which has many command

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread greg
Terry Reedy wrote: I believe the C standard specifies that the behavior of mixed reads and writes is undefined without intervening seek and/or flush, even if the seek is ignored (as it is on some Unix systems). With two threads, the timing is undetermined. It's also possible that the stdio

Python 2.6 still not giving memory back to the OS...

2009-08-15 Thread Chris Withers
Hi All, I thought this was fixed back in Python 2.5, but I guess not? So, I'm playing in an interactive session: from xlrd import open_workbook b = open_workbook('some.xls',pickleable=0,formatting_info=1) At this point, top shows the process usage for python to be about 500Mb. That's okay,

What happened to __cmp__() in Python 3.x?

2009-08-15 Thread Xavier Ho
Hey all, I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the documentation. Is there a substitution for this special method in 3.1, or do I really have to define all six rich comparison methods to work it out? If this question has already been asked somewhere, I

What's a good solution to implement rich comparison for user-defined classes? (was: What happened to __cmp__() in Python 3.x?)

2009-08-15 Thread Xavier Ho
Never mind my last email. Google actually found me something at last. I also found this page: http://mail.python.org/pipermail/python-list/2008-November/688591.html That still uses a sloppy way of defining the special methods, and a little chunky. Is there a better way for the lazy me?

Re: Python 'for' loop is memory inefficient

2009-08-15 Thread Steven D'Aprano
On Fri, 14 Aug 2009 18:25:45 -0700, Dr. Phillip M. Feldman wrote: It seems as though Python is actually expanding range(2,n) into a list of numbers, even though this is incredibly wasteful of memory. There should be a looping mechanism that generates the index variable values incrementally as

Re: Splitting a string into substrings of equal size

2009-08-15 Thread candide
Thanks to all for your response. I particularly appreciate Rascal's solution. -- http://mail.python.org/mailman/listinfo/python-list

Re: unittest

2009-08-15 Thread Steven D'Aprano
On Sat, 15 Aug 2009 07:32:15 -0400, Mag Gam wrote: So, in this example: import random In my case I would do import foo ? is there anything I need to do for that? Suppose you have a file mymodule.py containing your code, and you want some unit tests. If you only have a few, you can

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Michael Ströder
Hendrik van Rooyen wrote: In the past, on this group, I have made statements that said that on Linux, the serial port handling somehow does not allow transmitting and receiving at the same time, and nobody contradicted me. Despite all the good comments here by other skilled people I'd

Re: Splitting a string into substrings of equal size

2009-08-15 Thread Jan Kaliszewski
Dnia 15-08-2009 o 08:08:14 Rascal jonras...@gmail.com wrote: I'm bored for posting this, but here it is: def add_commas(str): str_list = list(str) str_len = len(str) for i in range(3, str_len, 3): str_list.insert(str_len - i, ',') return ''.join(str_list) For short

Re: Python 2.6 still not giving memory back to the OS...

2009-08-15 Thread Dave Angel
Chris Withers wrote: div class=moz-text-flowed style=font-family: -moz-fixedHi All, I thought this was fixed back in Python 2.5, but I guess not? So, I'm playing in an interactive session: from xlrd import open_workbook b = open_workbook('some.xls',pickleable=0,formatting_info=1) At this

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Grant Edwards
On 2009-08-15, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Friday 14 August 2009 16:19:04 Grant Edwards wrote: What platform are you using? I suppose it's possible that there's something broken in the serial driver for that particular hardware. Your experience seems to be exactly

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Grant Edwards
On 2009-08-15, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Friday 14 August 2009 16:03:22 Diez B. Roggisch wrote: You should *really* just use pyserial. No hassle, instant satisfaction. :-) I have downloaded and had a quick look, and I see it is based on the standard library's

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Grant Edwards
On 2009-08-15, Hendrik van Rooyen hend...@microcorp.co.za wrote: 8 -PosixSerial.py Thanks that looks, on first inspection, similar to the serialposix.py module in the stdlib, but less cluttered. pyserial is a bit more complex

Re: callable virtual method

2009-08-15 Thread Scott David Daniels
Jean-Michel Pichavant wrote: Steven D'Aprano wrote: On Fri, 14 Aug 2009 18:49:26 +0200, Jean-Michel Pichavant wrote: Sorry guys (means guys *and* gals :op ), I realized I've not been able to describe precisely what I want to do. I'd like the base class to be virtual (aka abstract). However

Re: Python 2.6 still not giving memory back to the OS...

2009-08-15 Thread Mark Dickinson
On Aug 15, 12:55 pm, Chris Withers ch...@simplistix.co.uk wrote: Hi All, I thought this was fixed back in Python 2.5, but I guess not? So, I'm playing in an interactive session:   from xlrd import open_workbook   b = open_workbook('some.xls',pickleable=0,formatting_info=1) At this point,

Re: Python docs disappointing - group effort to hire writers?

2009-08-15 Thread Mark Lawrence
Bill Jones wrote: On Aug 8, 3:27 pm, Mark Lawrence breamore...@yahoo.co.uk wrote: Kee Nethery wrote: As someone trying to learn the language I want to say that the tone on this list towards people who are trying to learn Python feels like it has become anti-newbies. [snip] Kee Nethery My

Error: No SSL support included in this Python ?

2009-08-15 Thread kramed
Hi there, I am running Windows on my dev machine and am running into the following error while running Django and my email routines. Exception Type: RuntimeError Exception Value:No SSL support included in this Python Exception Location: C:\Python26\lib\smtplib.py in starttls,

Re: unittest

2009-08-15 Thread Scott David Daniels
Mag Gam wrote: I am writing an application which has many command line arguments. For example: foo.py -args bar bee I would like to create a test suit using unittest so when I add features to foo.py I don't want to break other things. I just heard about unittest and would love to use it for

Re: What happened to __cmp__() in Python 3.x?

2009-08-15 Thread Mark Lawrence
Xavier Ho wrote: Hey all, I've recently made my way to Python 3.1 and I'm not seeing __cmp__() in the documentation. Is there a substitution for this special method in 3.1, or do I really have to define all six rich comparison methods to work it out? If this question has already been asked

Re: What's a good solution to implement rich comparison for user-defined classes? (was: What happened to __cmp__() in Python 3.x?)

2009-08-15 Thread Mark Lawrence
Xavier Ho wrote: Never mind my last email. Google actually found me something at last. I also found this page: http://mail.python.org/pipermail/python-list/2008-November/688591.html That still uses a sloppy way of defining the special methods, and a little chunky. Is there a better way for

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Saturday 15 August 2009 14:40:35 Michael Ströder wrote: Hendrik van Rooyen wrote: In the past, on this group, I have made statements that said that on Linux, the serial port handling somehow does not allow transmitting and receiving at the same time, and nobody contradicted me.

Re: Splitting a string into substrings of equal size

2009-08-15 Thread Emile van Sebille
On 8/14/2009 5:22 PM candide said... Suppose you need to split a string into substrings of a given size (except possibly the last substring). I make the hypothesis the first slice is at the end of the string. A typical example is provided by formatting a decimal string with thousands separator.

Re: Is it possible to use python to get True Full Duplex on a Serial port?

2009-08-15 Thread Hendrik van Rooyen
On Saturday 15 August 2009 16:25:03 Grant Edwards wrote: Are you using python file operations open/read/write or OS file-descriptor operations os.open/os.read/os.write? The former - that seems to be the source of my trouble. I have now written a little test that uses serial.Serial and it

Re: Python 2.6 still not giving memory back to the OS...

2009-08-15 Thread Christian Heimes
Mark Dickinson wrote: and got the expected memory usage for my Python process, as displayed by top: memory usage went up to nearly 1Gb after each assignment to b, then dropped down to 19 Mb or so after each 'del b'. I get similar results under Python 2.5. I get the same results on Linux:

Python-URL! - weekly Python news and links (Aug 15)

2009-08-15 Thread Gabriel Genellina
QOTW: They questioned my competence and that made her very sad. - Roger Wallis,expert witness for Pirate Bay, on his wife http://torrentfreak.com/pirate-bay-witness-wife-overwhelmed-with-flowers-090227/ unicode(s) is, surprisingly, MUCH faster (for certain encodings) than

getting the fractional part of a real?

2009-08-15 Thread Roy Smith
What's the best way to get the fractional part of a real? The two ways I can see are r % 1 and r = int(r), but both seem a bit hokey. Is there something more straight-forward that I'm missing, like fraction(r)? -- http://mail.python.org/mailman/listinfo/python-list

Re: getting the fractional part of a real?

2009-08-15 Thread Christian Heimes
Roy Smith schrieb: What's the best way to get the fractional part of a real? The two ways I can see are r % 1 and r = int(r), but both seem a bit hokey. Is there something more straight-forward that I'm missing, like fraction(r)? import math math.modf(1.5) (0.5, 1.0) Christian --

Re: getting the fractional part of a real?

2009-08-15 Thread Mark Dickinson
On Aug 15, 7:40 pm, Christian Heimes li...@cheimes.de wrote: Roy Smith schrieb: What's the best way to get the fractional part of a real?  The two ways I can see are r % 1 and r = int(r), but both seem a bit hokey.  Is there something more straight-forward that I'm missing, like

Re: Splitting a string into substrings of equal size

2009-08-15 Thread Gregor Lingl
What is the pythonic way to do this ? For my part, i reach to this rather complicated code: # -- def comaSep(z,k=3, sep=','): z=z[::-1] x=[z[k*i:k*(i+1)][::-1] for i in range(1+(len(z)-1)/k)][::-1] return sep.join(x) # Test for z in [75096042068045, 509,

Re: Splitting a string into substrings of equal size

2009-08-15 Thread Gregor Lingl
What is the pythonic way to do this ? For my part, i reach to this rather complicated code: # -- def comaSep(z,k=3, sep=','): z=z[::-1] x=[z[k*i:k*(i+1)][::-1] for i in range(1+(len(z)-1)/k)][::-1] return sep.join(x) # Test for z in [75096042068045, 509,

Re: Splitting a string into substrings of equal size

2009-08-15 Thread Gregor Lingl
Emile van Sebille schrieb: On 8/14/2009 5:22 PM candide said... ... What is the pythonic way to do this ? I like list comps... jj = '1234567890123456789' ,.join([jj[ii:ii+3] for ii in range(0,len(jj),3)]) '123,456,789,012,345,678,9' Emile Less beautiful but more correct:

Re: getting the fractional part of a real?

2009-08-15 Thread Gregor Lingl
Christian Heimes schrieb: Roy Smith schrieb: What's the best way to get the fractional part of a real? The two ways I can see are r % 1 and r = int(r), but both seem a bit hokey. Is there something more straight-forward that I'm missing, like fraction(r)? import math math.modf(1.5)

Re: A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode

2009-08-15 Thread John Nagle
fortunatus wrote: On Aug 14, 1:01 pm, vippstar vipps...@gmail.com wrote: Why would you fill your website with junk? The OP made it clear: Just wanted to express some frustration with whitespace-mode. Well, it took until Python 3.0 until Python enforced rules that ensured that the

Re: Python 'for' loop is memory inefficient

2009-08-15 Thread John Nagle
Hendrik van Rooyen wrote: On Saturday 15 August 2009 03:25:45 Dr. Phillip M. Feldman wrote: And while you are about it, you may as well teach them that it is much better to do a multiplication than a division. Actually, division speed hasn't been much of an issue in years. Arithmetic

random.gauss vs. random.normalvariate

2009-08-15 Thread Alan G Isaac
Quoting http://docs.python.org/3.1/library/random.html#random.gauss: Gaussian distribution. mu is the mean, and sigma is the standard deviation. This is slightly faster than the normalvariate() function defined below. So since both are offered and gauss is faster, I assume it must

Re: getting the fractional part of a real?

2009-08-15 Thread Roy Smith
In article 4a8704ca$0$2292$91cee...@newsreader02.highway.telekom.at, Gregor Lingl gregor.li...@aon.at wrote: Christian Heimes schrieb: Roy Smith schrieb: What's the best way to get the fractional part of a real? The two ways I can see are r % 1 and r = int(r), but both seem a bit hokey.

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-15 Thread Douglas Alan
On Aug 14, 10:25 pm, Dave Angel da...@ieee.org wrote: Benjamin Kaplan wrote: On Fri, Aug 14, 2009 at 12:42 PM, Douglas Alan darkwate...@gmail.comwrote: P.S. Overloading left shift to mean output does indeed seem a bit sketchy, but in 15 years of C++ programming, I've never seen it cause

Re: OT Signature quote [was Re: Unrecognized escape sequences in string literals]

2009-08-15 Thread John Haggerty
I guess the problem is---does it actually matter? On Fri, Aug 14, 2009 at 10:11 AM, Steven D'Aprano st...@remove-this-cybersource.com.au wrote: On Fri, 14 Aug 2009 07:07:31 -0700, Aahz wrote: I saw `cout' being shifted Hello world times to the left and stopped right there. --Steve

PyQt4.__file__ gives PyQt4/__init__.py as value

2009-08-15 Thread wgw
I don't understand why the __file__ value in my installation of PyQt would not give a proper, full path. I'm guessing that I did not install pyqt properly (I'm on Ubuntu Hardy, trying to install QT4.5), but before redoing the install, I want to see if there is a quicker fix. Also, though PyQt4/

Re: Splitting a string into substrings of equal size

2009-08-15 Thread Mark Tolonen
Gregor Lingl gregor.li...@aon.at wrote in message news:4a87036a$0$2292$91cee...@newsreader02.highway.telekom.at... Emile van Sebille schrieb: On 8/14/2009 5:22 PM candide said... ... What is the pythonic way to do this ? I like list comps... jj = '1234567890123456789'

Re: random.gauss vs. random.normalvariate

2009-08-15 Thread Carl Banks
On Aug 15, 12:49 pm, Alan G Isaac alan.is...@gmail.com wrote: Quotinghttp://docs.python.org/3.1/library/random.html#random.gauss:     Gaussian distribution. mu is the mean, and sigma is the     standard deviation. This is slightly faster than the     normalvariate() function defined below.

redoing libgmail interface to smtplib blah?

2009-08-15 Thread John Haggerty
The following program is theoretically supposed to use a supported library. Issues have come up where the library is not working and now another interface is being requierd to be used. At this point I'm looking at just changing the send commands but don't feel confident in doing so. Wondering

Re: random.gauss vs. random.normalvariate

2009-08-15 Thread John Haggerty
What does the term thread safe mean exactly. I never had to program with threads before On Sat, Aug 15, 2009 at 2:26 PM, Carl Banks pavlovevide...@gmail.comwrote: On Aug 15, 12:49 pm, Alan G Isaac alan.is...@gmail.com wrote: Quotinghttp://docs.python.org/3.1/library/random.html#random.gauss:

Why is unpacking of tuples only allowed when there's 1 tupple ?

2009-08-15 Thread Stef Mientki
hello, I'm not sure if unpacking is the right term but if I have a tuple of 2 arrays, I can either call a function with: Space_State = tf2ss ( filt[0], filt[1] ) or with Space_State = tf2ss ( *filt ) Now if I've to call a function with more parameters, why can't I use

Re: random.gauss vs. random.normalvariate

2009-08-15 Thread Alan G Isaac
On Aug 15, 12:49 pm, Alan G Isaac alan.is...@gmail.com wrote: Quotinghttp://docs.python.org/3.1/library/random.html#random.gauss: Gaussian distribution. mu is the mean, and sigma is the standard deviation. This is slightly faster than the normalvariate() function defined below.

Re: Why is unpacking of tuples only allowed when there's 1 tupple ?

2009-08-15 Thread Jan Kaliszewski
Dnia 15-08-2009 o 22:50:39 Stef Mientki stef.mien...@gmail.com napisał(a): hello, I'm not sure if unpacking is the right term but if I have a tuple of 2 arrays, I can either call a function with: Space_State = tf2ss ( filt[0], filt[1] ) or with Space_State = tf2ss (

Re: Python 'for' loop is memory inefficient

2009-08-15 Thread MRAB
John Nagle wrote: Hendrik van Rooyen wrote: On Saturday 15 August 2009 03:25:45 Dr. Phillip M. Feldman wrote: And while you are about it, you may as well teach them that it is much better to do a multiplication than a division. Actually, division speed hasn't been much of an issue in

Re: Why is unpacking of tuples only allowed when there's 1 tupple ?

2009-08-15 Thread Stef Mientki
thanks Jan, for the clear explanation. cheers, Stef Jan Kaliszewski wrote: Dnia 15-08-2009 o 22:50:39 Stef Mientki stef.mien...@gmail.com napisał(a): hello, I'm not sure if unpacking is the right term but if I have a tuple of 2 arrays, I can either call a function with:

Re: PyQt4.__file__ gives PyQt4/__init__.py as value

2009-08-15 Thread Christian Heimes
wgw wrote: I don't understand why the __file__ value in my installation of PyQt would not give a proper, full path. I'm guessing that I did not install pyqt properly (I'm on Ubuntu Hardy, trying to install QT4.5), but before redoing the install, I want to see if there is a quicker fix. Some

Python or ActionScript 3.0

2009-08-15 Thread Jaseem
Hi, Is python similar to actionscript 3.0 Which is better to create a rich gui internet application? Is it AS 3.0 with flex or python with its GUI libs? Is python in demand? Heard that python is similar to lisp. But both python and AS 3.0 is almost identical. Which is more similar to lisp are

Re: Splitting a string into substrings of equal size

2009-08-15 Thread ryles
On Aug 14, 8:22 pm, candide cand...@free.invalid wrote: Suppose you need to split a string into substrings of a given size (except possibly the last substring). I make the hypothesis the first slice is at the end of the string. A typical example is provided by formatting a decimal string with

Re: PyQt4.__file__ gives PyQt4/__init__.py as value

2009-08-15 Thread wgw
On Aug 15, 2:19 pm, Christian Heimes li...@cheimes.de wrote: wgw wrote: I don't understand why the __file__ value in my installation of PyQt would not give a proper, full path. I'm guessing that I did not install pyqt properly (I'm on Ubuntu Hardy, trying to install QT4.5), but before

Re: Splitting a string into substrings of equal size

2009-08-15 Thread MRAB
ryles wrote: On Aug 14, 8:22 pm, candide cand...@free.invalid wrote: Suppose you need to split a string into substrings of a given size (except possibly the last substring). I make the hypothesis the first slice is at the end of the string. A typical example is provided by formatting a decimal

Re: Splitting a string into substrings of equal size

2009-08-15 Thread Brian
On Sat, Aug 15, 2009 at 4:06 PM, MRAB pyt...@mrabarnett.plus.com wrote: ryles wrote: On Aug 14, 8:22 pm, candide cand...@free.invalid wrote: Suppose you need to split a string into substrings of a given size (except possibly the last substring). I make the hypothesis the first slice is at

Re: Splitting a string into substrings of equal size

2009-08-15 Thread MRAB
Brian wrote: On Sat, Aug 15, 2009 at 4:06 PM, MRAB pyt...@mrabarnett.plus.com mailto:pyt...@mrabarnett.plus.com wrote: ryles wrote: On Aug 14, 8:22 pm, candide cand...@free.invalid wrote: Suppose you need to split a string into substrings of a given

Re: Splitting a string into substrings of equal size

2009-08-15 Thread ryles
On Aug 15, 6:28 pm, MRAB pyt...@mrabarnett.plus.com wrote:       for z in [75096042068045, 509, 12024, 7, 2009]:            print re.sub(r(?=.)(?=(?:...)+$), ,, z)     75,096,042,068,045     509     12,024     7     2,009 The call replaces a zero-width match with a comma, ie

Python- javascript

2009-08-15 Thread Mike Paul
I'm trying to scrap a dynamic page with lot of javascript in it. Inorder to get all the data from the page i need to access the javascript. But i've no idea how to do it. Say I'm scraping some site htttp://www.xyz.com/xyz request=urllib2.Request(htttp://www.xyz.com/xyz)

Python - scraping - javascript

2009-08-15 Thread Mike Paul
I'm trying to scrap a dynamic page with lot of javascript in it. Inorder to get all the data from the page i need to access the javascript. But i've no idea how to do it. Say I'm scraping some site htttp://www.xyz.com/xyz request=urllib2.Request(htttp://www.xyz.com/xyz)

Re: Unrecognized escape sequences in string literals

2009-08-15 Thread Douglas Alan
On Aug 14, 1:55 pm, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: Douglas, you and I clearly have a difference of opinion on this. Neither of us have provided even the tiniest amount of objective, replicable, reliable data on the error-proneness of the C++ approach versus that

Re: Python 2.6 still not giving memory back to the OS...

2009-08-15 Thread John Machin
On Aug 16, 2:41 am, Mark Dickinson dicki...@gmail.com wrote: and got the expected memory usage for my Python process, as displayed by top:  memory usage went up to nearly 1Gb after each assignment to b, then dropped down to 19 Mb or so after each 'del b'.  I get similar results under Python

ignored test cases in unittest

2009-08-15 Thread Terry
Hi, I have some 100s unittest cases with my python program. And sometimes, I did quick-and-dirty work by ignoring some test cases by adding an 'x' (or something else) to the beginning of the case name. As time pass by, it's very hard for me to find which test cases are ignored. It seemed the to

Re: ignored test cases in unittest

2009-08-15 Thread Roy Smith
In article e30e5028-b50d-4a98-a70e-fca5b2a1c...@b14g2000yqd.googlegroups.com, Terry terry.yin...@gmail.com wrote: Hi, I have some 100s unittest cases with my python program. And sometimes, I did quick-and-dirty work by ignoring some test cases by adding an 'x' (or something else) to the

Re: Python or ActionScript 3.0

2009-08-15 Thread Douglas Alan
On Aug 15, 5:32 pm, Jaseem jas...@gmail.com wrote: Is python similar to actionscript 3.0 For some very rough sense of similar it might be, but not really. Which is better to create a rich gui internet application? Is it AS 3.0 with flex or python with its GUI libs? Python doesn't run in

Re: OptionParser How to: prog cmd [options] [arguments]

2009-08-15 Thread Steven Woody
Thanks for all you suggestions! -- http://mail.python.org/mailman/listinfo/python-list

Re: ignored test cases in unittest

2009-08-15 Thread John Haggerty
So you are saying you have several hundred tests you have to do on your program? On Sat, Aug 15, 2009 at 7:04 PM, Terry terry.yin...@gmail.com wrote: Hi, I have some 100s unittest cases with my python program. And sometimes, I did quick-and-dirty work by ignoring some test cases by adding an

Re: Python or ActionScript 3.0

2009-08-15 Thread John Haggerty
If it were me I'd go with python at least based on the fact that it's more supported and more popular, enough so that it has o'reiley soruces on it. On Sat, Aug 15, 2009 at 3:32 PM, Jaseem jas...@gmail.com wrote: Hi, Is python similar to actionscript 3.0 Which is better to create a rich gui

  1   2   >