Re: change text of a Tkinter Button by clicking it

2011-09-28 Thread Peter Otten
Sean McIlroy wrote: > hello > > (how) can you change the text of a Tkinter Button by clicking it? > something like > > def click(index): return lambda: buttons[index].text = 'hello' > buttons = [Button(root,command=click(index)) for index in > range(numbuttons)] > > only with an attribute that

Re: syntactic sugar for def?

2011-09-28 Thread Westley Martínez
On Wed, Sep 28, 2011 at 07:01:11PM -0400, Terry Reedy wrote: > On 9/28/2011 5:26 PM, Ethan Furman wrote: > > >I don't remember if 'def' is sugar for something besides lambda. > > That is a bit backwards. > lambda x: expr(x) > is syntactic sugar for > def (x): return expr(x) > del > ;-) >

Re: Suggested coding style

2011-09-28 Thread Westley Martínez
On Wed, Sep 28, 2011 at 07:11:08PM -0700, rantingrick wrote: > On Sep 28, 6:26 pm, Tim Johnson wrote: > > * DevPlayer [110928 04:31]: > > > On Sep 27, 10:25 pm, alex23 wrote: > > > > rantingrick wrote: > > > > > Since, like the bible > > > > > the zen is self contradicting, any argument utilizi

Re: change text of a Tkinter Button by clicking it

2011-09-28 Thread Sean McIlroy
never mind. i found it. -- http://mail.python.org/mailman/listinfo/python-list

Re: memory error

2011-09-28 Thread questions anon
Hello All, I am still having trouble with memory errors when I try to process many netcdf files. Originally I would get the memory error as mentioned in the previous post but when I added gc.collect() after each for loop I receive the error: GEOS_ERROR: bad allocation with no additional information

change text of a Tkinter Button by clicking it

2011-09-28 Thread Sean McIlroy
hello (how) can you change the text of a Tkinter Button by clicking it? something like def click(index): return lambda: buttons[index].text = 'hello' buttons = [Button(root,command=click(index)) for index in range(numbuttons)] only with an attribute that Buttons actually have. sorry to have to a

UnicodeDecodeError

2011-09-28 Thread gaurav gangalwar
I am getting this error while some testing on Python2.6, File "/usr/lib64/python2.6/httplib.py", line 774, in _send_output #msg = "\r\n".join(self._buffer) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position 14: ordinal not in range(128) I tried the change suggested on this

Re: A Trivial Question

2011-09-28 Thread Chris Angelico
On Thu, Sep 29, 2011 at 7:53 AM, Tayfun Kayhan wrote: > def trial(): >class Foo(object): > def __init__(self): > print("Hello, world!") > trial() # not worked, as expected. Python doesn't have "class declarations" in the way that some other languages do. The 'class' statement i

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Roy Smith
In article , Tim Chase wrote: > On 09/28/11 19:52, Roy Smith wrote: > > In many cases, there's only two states of interest: > > > > 1) All tests pass > > > > 2) Anything else > > Whether for better or worse, at some places (such as a previous > employer) the number (and accretion) of test-poin

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Tim Chase
On 09/28/11 19:52, Roy Smith wrote: In many cases, there's only two states of interest: 1) All tests pass 2) Anything else Whether for better or worse, at some places (such as a previous employer) the number (and accretion) of test-points is a marketing bullet-point for upgrades & new relea

Re: [OT] Benefit and belief

2011-09-28 Thread Ben Finney
Devin Jeanpierre writes: > > Forget money, or even the love of money. The idea that one mustn't > > criticise another person's beliefs is the root of all evil. > > This was a technical discussion, and calling the bible a joke was not > necessary at all. It creates a hostile atmosphere. I disagre

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Roy Smith
In article <874nzw3wxc@benfinney.id.au>, Ben Finney wrote: > Roy Smith writes: > > > In article <87k48szqo1@benfinney.id.au>, > > Ben Finney wrote: > > > > > Worse, if one of the scenarios causes the test to fail, the loop will > > > end and you won't get the results for the remainin

Re: Suggested coding style

2011-09-28 Thread alex23
On Sep 28, 10:12 pm, DevPlayer wrote: > Calling the Bible a joke is used to hurt people, not enlighten them. Y'know, I wouldn't even bother responding to this if Xianists were as open, forgiving and accepting as their messiah told them to be. It was a *flippant remark*. If you want to establish i

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Ben Finney
Steven D'Aprano writes: > I used to ask the same question, but then I decided that if I wanted > each data point to get its own tick, I should bite the bullet and > write an individual test for each. Hence my advocating the ‘testscenarios’ library. Have you tried that? It allows the best of bot

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Ben Finney
Roy Smith writes: > In article <87k48szqo1@benfinney.id.au>, > Ben Finney wrote: > > > Worse, if one of the scenarios causes the test to fail, the loop will > > end and you won't get the results for the remaining scenarios. > > Which, depending on what you're doing, may or may not be import

Re: Suggested coding style

2011-09-28 Thread DevPlayer
Oh I was just testing my intellecual-enlightenment-from-ranter- conversation algorithm found in a previous post. I think my OOP model failed as I'm just too tired to finished that pattern test. He had some good points which fit the process I layed out. But the original topic is just so much better:

Re: Suggested coding style

2011-09-28 Thread rantingrick
On Sep 28, 6:26 pm, Tim Johnson wrote: > * DevPlayer [110928 04:31]: > > On Sep 27, 10:25 pm, alex23 wrote: > > > rantingrick wrote: > > > > Since, like the bible > > > > the zen is self contradicting, any argument utilizing the zen can be > > > > defeated utilizing the zen. > > > > And like th

Re: Installing Python 2.6.7 on Windows

2011-09-28 Thread rantingrick
On Sep 27, 11:25 pm, Steven D'Aprano wrote: > The Python development team is relatively small and chronically busy: too > much to do and not enough time to do it. If that is the case then why do they snub their noses at anyone who wishes to help? What kind of people would chase off good help jus

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Eric Snow
On Wed, Sep 28, 2011 at 6:50 PM, Devin Jeanpierre wrote: >> I used to ask the same question, but then I decided that if I wanted each >> data point to get its own tick, I should bite the bullet and write an >> individual test for each. > > Nearly the entire re module test suite is a list of tuples

Re: Installing Python 2.6.7 on Windows

2011-09-28 Thread Gabriel Genellina
En Wed, 28 Sep 2011 21:10:38 -0300, Nobody escribió: On Wed, 28 Sep 2011 15:21:25 -0700, Ned Deily wrote: No, it was a deliberate decision. After a release is in security-fix mode only, we don't build Windows or Mac OS X installers for them. But you continue to offer the installers for the

Re: [OT] Benefit and belief [was Re: Suggested coding style]

2011-09-28 Thread Devin Jeanpierre
> Forget money, or even the love of money. The idea that one mustn't > criticise another person's beliefs is the root of all evil. This was a technical discussion, and calling the bible a joke was not necessary at all. It creates a hostile atmosphere. Can't you pick somewhere else to attack Chris

[OT] Benefit and belief [was Re: Suggested coding style]

2011-09-28 Thread Steven D'Aprano
DevPlayer wrote: > On Sep 27, 10:25 pm, alex23 wrote: >> And like the Bible, the Zen was created by humans as a joke. If you're >> taking it too seriously, that's your problem. [...] > Calling the Bible a joke is used to hurt people, not enlighten them. > Those words show bitter arrogance, not co

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Roy Smith
In article <87k48szqo1@benfinney.id.au>, Ben Finney wrote: > Worse, if one of the scenarios causes the test to fail, the loop will > end and you won't get the results for the remaining scenarios. Which, depending on what you're doing, may or may not be important. In many cases, there's on

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Devin Jeanpierre
> I used to ask the same question, but then I decided that if I wanted each > data point to get its own tick, I should bite the bullet and write an > individual test for each. Nearly the entire re module test suite is a list of tuples. If it was instead a bunch of TestCase classes, there'd be a lo

red bull hats, snapback hats, hello kitty hats, monster energy hats of http://www.currenthats.com/

2011-09-28 Thread Bertha Jonanna
Welcome to the www. currenthats.com,. The currenthats.com is a promotional shop from monster energy hats. It was authorized to provide red bull hats,snapback hats,hello kitty hats and the fashionable sports items to meet red bull hats Fans shopping needs. -- http://mail.python.org/mailman/listinfo

red bull hats, snapback hats, hello kitty hats, monster energy hats of http://www.currenthats.com/

2011-09-28 Thread Bertha Jonanna
Welcome to the www. currenthats.com,. The currenthats.com is a promotional shop from monster energy hats. It was authorized to provide red bull hats,snapback hats,hello kitty hats and the fashionable sports items to meet red bull hats Fans shopping needs. -- http://mail.python.org/mailman/listinfo

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Roy Smith
In article <4e83b8e0$0$29972$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > If you are writing loops inside tests, you might find this anecdote useful: > > http://mail.python.org/pipermail/python-list/2011-April/1270640.html On the other hand, the best test is one that gets writ

options for plotting points on geographic map

2011-09-28 Thread CM
Recommendations sought for using Python to plot points/custom markers (and maybe other things?) on a map of an area of the U.S. of maybe 100 miles radius. (This would be a "political" map showing towns, such as from Google Maps or Mapquest, and not a "physical" map). I'll need to place markers or

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Steven D'Aprano
Tim Chase wrote: > While I asked this on the Django list as it happened to be with > some Django testing code, this might be a more generic Python > question so I'll ask here too. > > When performing unittest tests, I have a number of methods of the > form > >def test_foo(self): > data

Re: Installing Python 2.6.7 on Windows

2011-09-28 Thread Nobody
On Wed, 28 Sep 2011 15:21:25 -0700, Ned Deily wrote: > No, it was a deliberate decision. After a release is in security-fix > mode only, we don't build Windows or Mac OS X installers for them. But you continue to offer the installers for the unfixed version. -- http://mail.python.org/mailman/

Re: Suggested coding style

2011-09-28 Thread Tim Johnson
* DevPlayer [110928 04:31]: > On Sep 27, 10:25 pm, alex23 wrote: > > rantingrick wrote: > > > Since, like the bible > > > the zen is self contradicting, any argument utilizing the zen can be > > > defeated utilizing the zen. > > > > And like the Bible, the Zen was created by humans as a joke. If

Re: Wrote a new library - Comments and suggestions please!

2011-09-28 Thread Gregory Ewing
Steven D'Aprano wrote: I googled on "SAS PROC FREQ" and found this: http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/procstat_freq_sect006.htm Documentation like that really makes me appreciate the sterling work done on Python's docs. I think you have to read it in con

Re: syntactic sugar for def?

2011-09-28 Thread Terry Reedy
On 9/28/2011 5:26 PM, Ethan Furman wrote: I don't remember if 'def' is sugar for something besides lambda. That is a bit backwards. lambda x: expr(x) is syntactic sugar for def (x): return expr(x) del ;-) -- Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: syntactic sugar for def?

2011-09-28 Thread Eric Snow
On Wed, Sep 28, 2011 at 3:26 PM, Ethan Furman wrote: > I remember that 'class' is sugar for type(). > > I don't remember if 'def' is sugar for something besides lambda. This is something I have thought about a lot since PyCon this year. I apologize in advance. Since 3.0, class statements

Re: syntactic sugar for def?

2011-09-28 Thread Gabriel Genellina
En Wed, 28 Sep 2011 18:51:00 -0300, Chris Kaynor escribió: On Wed, Sep 28, 2011 at 2:37 PM, Arnaud Delobelle wrote: On 28 September 2011 22:26, Ethan Furman wrote: I remember that 'class' is sugar for type(). I don't remember if 'def' is sugar for something besides lambda. Any clue

Re: Installing Python 2.6.7 on Windows

2011-09-28 Thread Ned Deily
In article <4e82a1a1$0$29965$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > On Tue, 27 Sep 2011 14:32:43 -0700, Wanderer wrote: > > I need to stay in sink with the rest of the company which is still using > > 2.6 flavors. There was some investigation into going to Python 3 but not

Re: A Trivial Question

2011-09-28 Thread Chris Rebert
On Wed, Sep 28, 2011 at 2:53 PM, Tayfun Kayhan wrote: > I accidentally wrote such a code (below) while trying to write sth else for > my application but i am now just wondering much how to run the class Foo, if > it is possible. Is not it weird that Python does not give any error when I > run it ?

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Terry Reedy
On 9/28/2011 10:16 AM, Tim Chase wrote: When performing unittest tests, I have a number of methods of the form def test_foo(self): data = ( (item1, result1), ... #bunch of tests for fence-post errors ) for test, result in data: self.assertEqual(process(test), result) When I run my tests, I onl

A Trivial Question

2011-09-28 Thread Tayfun Kayhan
I accidentally wrote such a code (below) while trying to write sth else for my application but i am now just wondering much how to run the class Foo, if it is possible. Is not it weird that Python does not give any error when I run it ? Sorry for that it's pretty unimportant question according t

Re: syntactic sugar for def?

2011-09-28 Thread Chris Kaynor
On Wed, Sep 28, 2011 at 2:37 PM, Arnaud Delobelle wrote: > On 28 September 2011 22:26, Ethan Furman wrote: >> I remember that 'class' is sugar for type(). >> >> I don't remember if 'def' is sugar for something besides lambda. >> >> Any clues for me?  Heck, I'll even be grateful for outright a

Re: syntactic sugar for def?

2011-09-28 Thread Arnaud Delobelle
On 28 September 2011 22:26, Ethan Furman wrote: > I remember that 'class' is sugar for type(). > > I don't remember if 'def' is sugar for something besides lambda. > > Any clues for me?  Heck, I'll even be grateful for outright answers! It's not really sugar. But I think you mean something l

Re: syntactic sugar for def?

2011-09-28 Thread Ian Kelly
On Wed, Sep 28, 2011 at 3:26 PM, Ethan Furman wrote: > I remember that 'class' is sugar for type(). > > I don't remember if 'def' is sugar for something besides lambda. > > Any clues for me?  Heck, I'll even be grateful for outright answers! If you mean is there a way to create functions usin

syntactic sugar for def?

2011-09-28 Thread Ethan Furman
I remember that 'class' is sugar for type(). I don't remember if 'def' is sugar for something besides lambda. Any clues for me? Heck, I'll even be grateful for outright answers! ~Ethan~ -- http://mail.python.org/mailman/listinfo/python-list

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Terry Reedy
On 9/28/2011 5:28 AM, Xah Lee wrote: curious question. suppose you have 300 different strings and they need all be replaced to say "aaa". is it faster to replace each one sequentially (i.e. replace first string to aaa, then do the 2nd, 3rd,...) , or is it faster to use a regex with “or” them al

Re: new to python question

2011-09-28 Thread Benjamin Kaplan
On Wed, Sep 28, 2011 at 5:06 PM, The Geek wrote: > I'm clearly not understanding something about scope in python...  Any help > is appreciated > In the following script I'm attempting to create 2 Foo objects, for each Foo > object I create 2 Bars and add them to Foo's bar array > Something hokey i

new to python question

2011-09-28 Thread The Geek
I'm clearly not understanding something about scope in python... Any help is appreciated In the following script I'm attempting to create 2 Foo objects, for each Foo object I create 2 Bars and add them to Foo's bar array Something hokey is occurring with the "foo.bars.append(bar)" line such that

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread John Bokma
Willem writes: > Eli the Bearded wrote: > ) In comp.lang.perl.misc, Willem wrote: > )> In Perl, it would be applicable. You see, in Perl, you can call a function > )> in the replacement of the regex substitution, which can then look up the > )> html entity and return the wanted unicode literal

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Willem
Eli the Bearded wrote: ) In comp.lang.perl.misc, Willem wrote: )> In Perl, it would be applicable. You see, in Perl, you can call a function )> in the replacement of the regex substitution, which can then look up the )> html entity and return the wanted unicode literal. ) ) A function? I'd use a

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Eli the Bearded
In comp.lang.perl.misc, Willem wrote: > In Perl, it would be applicable. You see, in Perl, you can call a function > in the replacement of the regex substitution, which can then look up the > html entity and return the wanted unicode literal. A function? I'd use a hash. > I think you can do th

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Ian Kelly
On Wed, Sep 28, 2011 at 3:28 AM, Xah Lee wrote: > curious question. > > suppose you have 300 different strings and they need all be replaced > to say "aaa". > > is it faster to replace each one sequentially (i.e. replace first > string to aaa, then do the 2nd, 3rd,...) > , or is it faster to use a

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread MRAB
On 28/09/2011 18:00, Willem wrote: Xah Lee wrote: ) the question originally came from when i was coding elisp of a ) function that changes html entities to unicode char literal. The ) problem is slightly complicated, involving a few questions about speed ) in emacs. e.g. string vs buffer, and muc

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Willem
Xah Lee wrote: ) the question originally came from when i was coding elisp of a ) function that changes html entities to unicode char literal. The ) problem is slightly complicated, involving a few questions about speed ) in emacs. e.g. string vs buffer, and much more... i spent several ) hours on

Re: Python 2.5 zlib trouble

2011-09-28 Thread Alec Taylor
Fix: http://lipyrary.blogspot.com/2011/05/how-to-compile-python-on-ubuntu-1104.html On Tue, Sep 27, 2011 at 5:04 AM, Benjamin Kaplan wrote: > On Mon, Sep 26, 2011 at 2:16 PM, Jesramz > wrote: >> >> I appreciate all the help, but I am still a little confused. Sorry, >> I'm a lay person. >> >> S

Re: how to run in xp?

2011-09-28 Thread David Robinow
On Wed, Sep 28, 2011 at 9:29 AM, Peter Otten <__pete...@web.de> wrote: > =?gbk?B?ytjW6rT9zcM=?= wrote: > >> it can run ,but there is still a problem ,nothing in my file. >> please run the code in xp+python32 >> import urllib.request, urllib.parse, urllib.error >> exchange=['NASDAQ','NYSE','AMEX'] >

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Ben Finney
Ben Finney writes: > You can use the third-party ‘testscenarios’ library The URL got a bit mangled. The proper PyPI URL for that library is http://pypi.python.org/pypi/testscenarios>. > to generate test cases at run time, one for each combination of > scenarios with test cases on the class. The

Re: Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Ben Finney
Tim Chase writes: > def test_foo(self): > data = ( > (item1, result1), > ... #bunch of tests for fence-post errors > ) > for test, result in data: > self.assertEqual(process(test), result) The sets of data for running the same test we might call “scenarios”. >

Re: Suggested coding style

2011-09-28 Thread Ben Finney
DevPlayer writes: > Calling the Bible a joke is used to hurt people, not enlighten them. How do you know that? > Those words show bitter arrogance, not constructive critism How do you know that? > as it ignores how others feel about that book. That strikes me as a good thing; how people feel

Unittest testing assert*() calls rather than methods?

2011-09-28 Thread Tim Chase
While I asked this on the Django list as it happened to be with some Django testing code, this might be a more generic Python question so I'll ask here too. When performing unittest tests, I have a number of methods of the form def test_foo(self): data = ( (item1, result1),

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Chris Angelico
On Wed, Sep 28, 2011 at 11:22 PM, Neil Cerutti wrote: > I'd like to know what "string replacement" is supposed to mean in > the context of Python. > Substring replacement, such as: >>> "Hello, world!".replace(", "," -- ") 'Hello -- world!' The str method doesn't accept a list, though, so it won'

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Roy Smith
In article <9egld1f38...@mid.individual.net>, Neil Cerutti wrote: > On 2011-09-28, Chris Angelico wrote: > > On Wed, Sep 28, 2011 at 10:28 PM, Xah Lee wrote: > >> each string needs to be changed to a unique string, not all to > >> the same string. > > > > And you'll find that this is, by and l

Re: how to run in xp?

2011-09-28 Thread Peter Otten
=?gbk?B?ytjW6rT9zcM=?= wrote: > it can run ,but there is still a problem ,nothing in my file. > please run the code in xp+python32 > import urllib.request, urllib.parse, urllib.error > exchange=['NASDAQ','NYSE','AMEX'] > for down in exchange: > url='http://www.nasdaq.com/screening/companies-by

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Neil Cerutti
On 2011-09-28, Chris Angelico wrote: > On Wed, Sep 28, 2011 at 10:28 PM, Xah Lee wrote: >> each string needs to be changed to a unique string, not all to >> the same string. > > And you'll find that this is, by and large, the most normal > situation. Folding many strings down to one string is a l

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Chris Angelico
On Wed, Sep 28, 2011 at 11:14 PM, Xah Lee wrote: > (while (< ii (length pairs)) >      (setq mystr (replace-regexp-in-string >                   (elt tempMapPoints ii) >                   (elt (elt pairs ii) 1) >                   mystr t t)) >      (setq ii (1+ ii)) >      ) from __future__ impo

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Xah Lee
here's more detail about the origin of this problem. Relevant to emacs lisp only. -- in the definition of “replace-regexp-in-string”, there's this comment: ;; To avoid excessive consing from multiple matches in long strings, ;; don't just call `replace-match' cont

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Chris Angelico
On Wed, Sep 28, 2011 at 10:28 PM, Xah Lee wrote: > each string needs to be changed to a unique > string, not all to the same string. And you'll find that this is, by and large, the most normal situation. Folding many strings down to one string is a lot less common. So, let's have some real-world

Re: oauth2 server implementation

2011-09-28 Thread Roy Smith
In article <862e37e9-f4d2-4423-8d28-485923f1c...@p11g2000yqe.googlegroups.com>, Aljosa Mohorovic wrote: > On Sep 28, 2:17 am, Roy Smith wrote: > > We rolled our own oauth2 client on top of basic urllib calls.  It's not > > terribly difficult. > > i'm asking about oauth2 server implementation,

Re: Hierarchical commnd line parsing / help texts

2011-09-28 Thread Michele Simionato
plac is based on argparser and it is intended to be much easier to use. See http://plac.googlecode.com/hg/doc/plac.html Here is an example of usage. $ cat vcs.py class VCS(object): "A fictitious version control tool" commands = ['checkout', 'commit'] def checkout(self, url): r

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Xah Lee
On Sep 28, 3:57 am, mer...@stonehenge.com (Randal L. Schwartz) wrote: > > "Xah" == Xah Lee writes: > > Xah> curious question. > Xah> suppose you have 300 different strings and they need all be replaced > Xah> to say "aaa". > > And then suppose this isn't the *real* question, but one entirely o

Re: Suggested coding style

2011-09-28 Thread DevPlayer
On Sep 27, 10:25 pm, alex23 wrote: > rantingrick wrote: > > Since, like the bible > > the zen is self contradicting, any argument utilizing the zen can be > > defeated utilizing the zen. > > And like the Bible, the Zen was created by humans as a joke. If you're > taking it too seriously, that's y

Re: how to run in xp?

2011-09-28 Thread 守株待兔
it can run ,but there is still a problem ,nothing in my file. please run the code in xp+python32 import urllib.request, urllib.parse, urllib.error exchange=['NASDAQ','NYSE','AMEX'] for down in exchange: url='http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange='+down+'&render=do

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Randal L. Schwartz
> "Xah" == Xah Lee writes: Xah> curious question. Xah> suppose you have 300 different strings and they need all be replaced Xah> to say "aaa". And then suppose this isn't the *real* question, but one entirely of Fiction by Xah Lee. How helpful do you want to be? -- Randal L. Schwartz - St

RE: python 2.7.1 HP-UX 11 ia64 built not supporting thread

2011-09-28 Thread Wong Wah Meng-R32813
Hello there, I included --with-threads option into the configure script calling, which it failed to add the -D_REENTRANT into Makefile. So I manually added this into OPT of the Makefile. I ran make again and generated a new python binary. However, the new binary is still not able to start a new

Re: oauth2 server implementation

2011-09-28 Thread Aljosa Mohorovic
On Sep 28, 2:17 am, Roy Smith wrote: > We rolled our own oauth2 client on top of basic urllib calls.  It's not > terribly difficult. i'm asking about oauth2 server implementation, not client. it's easy to consume oauth2 stuff but what to do when you need to implement server side stuff? Aljosa --

Re: question about speed of sequential string replacement vs regex or

2011-09-28 Thread Chris Angelico
On Wed, Sep 28, 2011 at 7:28 PM, Xah Lee wrote: > suppose you have 300 different strings and they need all be replaced > to say "aaa". > > is it faster to replace each one sequentially Before you ask "is it faster", you need to first be sure it's correct. I would recommend doing all the replaces

question about speed of sequential string replacement vs regex or

2011-09-28 Thread Xah Lee
curious question. suppose you have 300 different strings and they need all be replaced to say "aaa". is it faster to replace each one sequentially (i.e. replace first string to aaa, then do the 2nd, 3rd,...) , or is it faster to use a regex with “or” them all and do replace one shot? (i.e. "1stst

python 2.7.1 built not supporting thread?

2011-09-28 Thread Wong Wah Meng-R32813
Hello there, I couldn't detect this problem until I run my application that utilizes thread module in python that I just built on HP-UX 11.31 ia64 using aCC. Could it be the build did not include enable thread option? _REENTRANT as stated in the README file? If yes, it looks like threading may

Re: how to run in xp?

2011-09-28 Thread Peter Otten
=?gbk?B?ytjW6rT9zcM=?= wrote: > #coding:utf-8 > import urllib > exchange=['NASDAQ','NYSE','AMEX'] > for down in exchange: > myfile=open('./'+down,'w') > url='http://www.nasdaq.com/screening/companies- \ > by-industry.aspx?exchange='+down+'&render=download' > file=urllib.urlopen(ur

Re: Multiplication error in python

2011-09-28 Thread Chris Angelico
On Wed, Sep 28, 2011 at 4:28 PM, Tim Roberts wrote: > My guess is that you actually typed >    p=3*a > instead of >    p=2*a > > That produces 45. > Or alternatively, that you used an interactive Python environment and didn't clear i between runs. ChrisA -- http://mail.python.org/mailman/listin

how to run in xp?

2011-09-28 Thread 守株待兔
#coding:utf-8 import urllib exchange=['NASDAQ','NYSE','AMEX'] for down in exchange: myfile=open('./'+down,'w') url='http://www.nasdaq.com/screening/companies- \ by-industry.aspx?exchange='+down+'&render=download' file=urllib.urlopen(url).read() myfile.write(file) print ('ok',d