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 , Prateek 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: http://www.nltk.org/ -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/l

Re: Natural Language Processing in Python

2009-08-15 Thread Vlastimil Brom
2009/8/14 Prateek : > 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 http://www.nltk.o

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 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 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 -- http://mail.python.org/mailman/listinfo/python

Re: anyone with genomewide microarray analysis experience ?

2009-08-15 Thread Istvan Albert
On Aug 14, 8:52 am, trias 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 as the chromosome, then

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=true&text=Content+to+extract terms from Hope this helps Fotoroll Term extraction No limit on number of queries per day Yahoo 5000 queries a day Zemant

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,

"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) Wh

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 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]]])) > > So, all the Funcs

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 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 one, and to try wi

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. An

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 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. > > There are

Re: "for" cycle with assigning index

2009-08-15 Thread Paul Rubin
Carl Banks 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 index variable:

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 wrote: > • A Exhibition Of Tech Geekers Incompetence: Emacs whitespace-mode > http://xahlee.org/UnixResource_dir/writ/e

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 wrote: > > Hendrik van Rooyen wrote: 8<--- > Doh! It didn't even occur to me that somebody would use python > "file" objects for serial ports, and I completely

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

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

2009-08-15 Thread Carl Banks
On Aug 14, 10:15 pm, Bill Jones wrote: > On Aug 8, 3:27 pm, Mark Lawrence 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 their response is to shutdown changes

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 s

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 Rooyen 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 >> >> Assuming th

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 >

Re: Python 'for' loop is memory inefficient

2009-08-15 Thread John Machin
On Aug 15, 11:38 am, Mark Lawrence 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 code with a value o

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

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

2009-08-15 Thread Byung-Hee HWANG
Xah Lee 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 passion on Elisp, P

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 int

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 Thomas wrote: > On Aug 15, 4:28 am, Mag Gam wrote: >> I am writing an application which has many command line arguments. >> For example:

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 o

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 o

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 apologise

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? Ching-Yu

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

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, y

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 rec

Re: Splitting a string into substrings of equal size

2009-08-15 Thread Jan Kaliszewski
Dnia 15-08-2009 o 08:08:14 Rascal 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 strings (for sure most

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

2009-08-15 Thread Dave Angel
Chris Withers 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, top shows the process usage for python to be

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 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 the opposite t

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 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 serial.Serial class - a

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 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 because it is cross-p

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 i

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 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, top sh

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 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 gut feeling (which could

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, l

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 som

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 the

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 w

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: Pyt

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 s.decode

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 -- http://m

Re: getting the fractional part of a real?

2009-08-15 Thread Mark Dickinson
On Aug 15, 7:40 pm, Christian Heimes 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 fraction(r)? > >>>

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) (0.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 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 indentation the user see

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 has

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 have

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 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. > >> I

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 wrote: > Benjamin Kaplan wrote: > > On Fri, Aug 14, 2009 at 12:42 PM, Douglas Alan wrote: > >> 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 > >> any confusion or b

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." --S

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/ i

Re: Splitting a string into substrings of equal size

2009-08-15 Thread Mark Tolonen
"Gregor Lingl" 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' >>> ",".join([jj[ii:ii+3] for i

Re: random.gauss vs. random.normalvariate

2009-08-15 Thread Carl Banks
On Aug 15, 12:49 pm, Alan G Isaac 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. > > So since both ar

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 spec

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 wrote: > On Aug 15, 12:49 pm, Alan G Isaac wrote: > > Quotinghttp://docs.python.org/3.1/library/random.html#random.gauss: > > Gaussian distribution. mu is t

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 (Pol

Re: random.gauss vs. random.normalvariate

2009-08-15 Thread Alan G Isaac
> On Aug 15, 12:49 pm, Alan G Isaac 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. >> >> So since

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 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 ( *filt ) Now if I've to

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 yea

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 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]

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 ve

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 pow

Re: Splitting a string into substrings of equal size

2009-08-15 Thread ryles
On Aug 14, 8:22 pm, candide 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 thousands > separ

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

2009-08-15 Thread wgw
On Aug 15, 2:19 pm, Christian Heimes 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 redoing t

Re: Splitting a string into substrings of equal size

2009-08-15 Thread MRAB
ryles wrote: On Aug 14, 8:22 pm, candide 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 thousands

Re: Splitting a string into substrings of equal size

2009-08-15 Thread Brian
On Sat, Aug 15, 2009 at 4:06 PM, MRAB wrote: > ryles wrote: > >> On Aug 14, 8:22 pm, candide 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. >

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 > wrote: ryles wrote: On Aug 14, 8:22 pm, candide wrote: Suppose you need to split a string into substrings of a given size (except possibly the last substr

Re: Splitting a string into substrings of equal size

2009-08-15 Thread ryles
On Aug 15, 6:28 pm, MRAB 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,

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") response=urllib2.urlopen

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") response=urllib2.urlopen

Re: Unrecognized escape sequences in string literals

2009-08-15 Thread Douglas Alan
On Aug 14, 1:55 pm, Steven D'Aprano 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 of > Python. The supposed superior

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 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. > > So maybe

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 m

Re: ignored test cases in unittest

2009-08-15 Thread Roy Smith
In article , Terry 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 beginning of the case name. > As time pass by, it's very hard for me to find which t

Re: Python or ActionScript 3.0

2009-08-15 Thread Douglas Alan
On Aug 15, 5:32 pm, Jaseem 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 your typical we

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

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

Re: Python- javascript

2009-08-15 Thread Douglas Alan
On Aug 15, 8:02 pm, Mike Paul wrote: > 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. I'm not sure exactly what you are trying to do, but scraping websites that use a l

Re: ignored test cases in unittest

2009-08-15 Thread Ben Finney
Terry writes: > It seemed the to me that python unittest module does not support the > counting of ignored test cases directly. Is there any ready solution > for this? One solution I've seen involves: * a custom exception class, ‘TestSkipped’ * raising that exception at the top of test cases y

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

2009-08-15 Thread Steven D'Aprano
On Sat, 15 Aug 2009 13:01:43 -0700, Douglas Alan wrote: > P.S. I find it strange, however, that anyone who is not okay with > "abusing" operator overloading in this manner, wouldn't also take > umbrage at Python's overloading of "+" to work with strings and lists, > etc. Numerical addition and seq

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

2009-08-15 Thread Steven D'Aprano
On Sat, 15 Aug 2009 12:24:26 -0700, John Nagle wrote: > fortunatus wrote: >> On Aug 14, 1:01 pm, vippstar 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.

  1   2   >