RE: a problem about "print"

2012-07-03 Thread Shambhu Rajak
You can use : print "aList is "+repr([x,x,x,x,x,x,x,x,x]) -Shambhu From: levi nie [mailto:levinie...@gmail.com] Sent: 04/07/2012 9:43 AM To: python-list@python.org Subject: a problem about "print" aList is a list.i want to get the output seem this "aList is [x,x,x,x,x,x,x,x,x]" how can i get th

Re: code review

2012-07-03 Thread Littlefield, Tyler
On 7/3/2012 10:55 PM, Simon Cropper wrote: Some questions to Tyler Littlefield, who started this thread. Q1 -- Did you get any constructive feedback on your code? I did get some, which I appreciated. someone mentioned using PyLint. From reading, I found it was really really pedantic, so I use

Re: code review

2012-07-03 Thread Simon Cropper
On 04/07/12 13:53, Chris Angelico wrote: On Wed, Jul 4, 2012 at 12:57 PM, wrote: Well, if you waited until you had the password (however long) in a variable before you applied your maximum limits, the DoS ship has probably sailed already. Only because data transfer is usually more expensiv

Re: a problem about "print"

2012-07-03 Thread Harrison Morgan
On Wed, Jul 4, 2012 at 12:16 AM, levi nie wrote: > print "aList is "+string(aList) ? > > > 2012/7/4 levi nie > >> aList is a list.i want to get the output seem this "aList is >> [x,x,x,x,x,x,x,x,x]" >> how can i get this? >> it's wrong when i write this, print "aList is "+[x,x,x,x,x,x,x,x,x] >>

Re: a problem about "print"

2012-07-03 Thread levi nie
print "aList is "+string(aList) ? 2012/7/4 levi nie > aList is a list.i want to get the output seem this "aList is > [x,x,x,x,x,x,x,x,x]" > how can i get this? > it's wrong when i write this, print "aList is "+[x,x,x,x,x,x,x,x,x] > -- http://mail.python.org/mailman/listinfo/python-list

a problem about "print"

2012-07-03 Thread levi nie
aList is a list.i want to get the output seem this "aList is [x,x,x,x,x,x,x,x,x]" how can i get this? it's wrong when i write this, print "aList is "+[x,x,x,x,x,x,x,x,x] -- http://mail.python.org/mailman/listinfo/python-list

Re: code review

2012-07-03 Thread Chris Angelico
On Wed, Jul 4, 2012 at 12:57 PM, wrote: > Well, if you waited until you had the password (however long) in a variable > before you applied your maximum limits, the DoS ship has probably sailed > already. Only because data transfer is usually more expensive than hashing. But I'd say that'll alw

Re: code review

2012-07-03 Thread kushal . kumaran+python
Ian Kelly wrote: >On Tue, Jul 3, 2012 at 11:53 AM, Kushal Kumaran > wrote: >> On Sat, Jun 30, 2012 at 3:34 PM, Alister >wrote: >>> On Fri, 29 Jun 2012 09:03:22 -0600, Littlefield, Tyler wrote: >>> On 6/29/2012 1:31 AM, Steven D'Aprano wrote: > On Thu, 28 Jun 2012 20:58:15 -0700, alex23

Re: exe made by py2exe do not run certain computer

2012-07-03 Thread Mark Hammond
On 4/07/2012 9:46 AM, Miki Tebeka wrote: It works fine on my computer and some other computer don't have python interpreter(it's Windows 7). But the same file also do not work on another computer(it's Windows xp) why does it happen? My *guess* is that you're missing some DLLs (probably some Visu

Re: exe made by py2exe do not run certain computer

2012-07-03 Thread Miki Tebeka
> It works fine on my computer and some other computer don't have python > interpreter(it's Windows 7). > But the same file also do not work on another computer(it's Windows xp) > why does it happen? My *guess* is that you're missing some DLLs (probably some Visual Studio runtime ones). You can

Re: Why site-packages?

2012-07-03 Thread Ian Kelly
On Tue, Jul 3, 2012 at 5:06 PM, Ian Kelly wrote: > On Tue, Jul 3, 2012 at 4:38 PM, Dan Stromberg wrote: >>> Right now this all seems highly speculative to me. I think it might >>> be informative, either to you or to me, to do an actual timing test. >>> Why don't you try setting up two side-by-si

Re: Dictless classes

2012-07-03 Thread Terry Reedy
On 7/3/2012 1:03 AM, Steven D'Aprano wrote: You can create instances without a __dict__ by setting __slots__: Each *instance* does not have its own dict because each would be equal, therefore only one hidden mapping is needed, somewhere. But attribute names must be mapped to objects somehow.

Re: Why site-packages?

2012-07-03 Thread Ian Kelly
On Tue, Jul 3, 2012 at 4:38 PM, Dan Stromberg wrote: >> Right now this all seems highly speculative to me. I think it might >> be informative, either to you or to me, to do an actual timing test. >> Why don't you try setting up two side-by-side installations of Python, >> one with all the site-pa

Re: Why site-packages?

2012-07-03 Thread Dan Stromberg
On Tue, Jul 3, 2012 at 10:04 PM, Ian Kelly wrote: > > >> The site module has to process any .pth files in the site-packages, > >> but apart from that, I think the actual amount of stuff in > >> site-packages should be irrelevant. > > > > Irrelevant to what? More stuff in site slowing things dow

Re: Why site-packages?

2012-07-03 Thread Ian Kelly
On Tue, Jul 3, 2012 at 3:34 PM, Dan Stromberg wrote: > If it was intended to be reusable code, I'd think it -should- go in > site-packages. > > But so much code in site-packages isn't intended to be reusable. Can you give some examples? Looking through my site-packages directory, everything in t

Re: Why site-packages?

2012-07-03 Thread Thomas Jollans
On 07/03/2012 11:34 PM, Dan Stromberg wrote: > On Tue, Jul 3, 2012 at 9:04 PM, Ian Kelly > wrote: > > On Tue, Jul 3, 2012 at 2:40 PM, Dan Stromberg > wrote: > > > > Why is it that so much 3rd party python code gets install

Re: code review

2012-07-03 Thread Chris Angelico
On Wed, Jul 4, 2012 at 6:13 AM, Dave Angel wrote: > On 07/03/2012 12:05 PM, Mark Lawrence wrote: >> If I go to the moon I will weigh 2st 10lb (if my sums are correct :) >> but the equivalent Frenchman will still be 86kg. I hereby put this >> forward as proof that the metric system is rubbish and w

Re: code review

2012-07-03 Thread Chris Angelico
On Wed, Jul 4, 2012 at 4:27 AM, Ian Kelly wrote: > On Tue, Jul 3, 2012 at 12:18 PM, John Gordon wrote: >> As a practical matter, doesn't there have to be *some* sort of limit? >> For example if the (encrypted) password is stored in a database, you can't >> exceed the table column width. > > Hopef

Re: Why site-packages?

2012-07-03 Thread Dan Stromberg
On Tue, Jul 3, 2012 at 9:04 PM, Ian Kelly wrote: > On Tue, Jul 3, 2012 at 2:40 PM, Dan Stromberg wrote: > > > > Why is it that so much 3rd party python code gets installed to > > site-packages? > > Because that's what site-packages is for? > Agh. But -why- is it because that's what it's for?

Re: Why site-packages?

2012-07-03 Thread Ian Kelly
On Tue, Jul 3, 2012 at 2:40 PM, Dan Stromberg wrote: > > Why is it that so much 3rd party python code gets installed to > site-packages? Because that's what site-packages is for? > Even for things that are almost certainly going to be used by a single > application? > > Even for things you might

Why site-packages?

2012-07-03 Thread Dan Stromberg
Why is it that so much 3rd party python code gets installed to site-packages? Even for things that are almost certainly going to be used by a single application? Even for things you might only use once? Even for things that might require one version for one app, and another version for another a

Re: code review

2012-07-03 Thread Dave Angel
On 07/03/2012 12:05 PM, Mark Lawrence wrote: > On 03/07/2012 16:53, Chris Angelico wrote: >> On Wed, Jul 4, 2012 at 1:50 AM, Mark Lawrence >> wrote: >>> On 03/07/2012 03:25, John O'Hagan wrote: On Tue, 3 Jul 2012 11:22:55 +1000 I agree to some extent, but as a counter-example,

Re: code review

2012-07-03 Thread Ian Kelly
On Tue, Jul 3, 2012 at 12:18 PM, John Gordon wrote: > In Kushal Kumaran > writes: > >> I haven't actually seen the rest of the code, but I would like to >> point out that applications placing maximum length limits on passwords >> are extremely annoying. > > As a practical matter, doesn't there

Re: code review

2012-07-03 Thread John Gordon
In Kushal Kumaran writes: > I haven't actually seen the rest of the code, but I would like to > point out that applications placing maximum length limits on passwords > are extremely annoying. As a practical matter, doesn't there have to be *some* sort of limit? For example if the (encrypted)

Re: code review

2012-07-03 Thread Ian Kelly
On Tue, Jul 3, 2012 at 11:53 AM, Kushal Kumaran wrote: > On Sat, Jun 30, 2012 at 3:34 PM, Alister wrote: >> On Fri, 29 Jun 2012 09:03:22 -0600, Littlefield, Tyler wrote: >> >>> On 6/29/2012 1:31 AM, Steven D'Aprano wrote: On Thu, 28 Jun 2012 20:58:15 -0700, alex23 wrote: > On Jun 29

Re: code review

2012-07-03 Thread Kushal Kumaran
On Sat, Jun 30, 2012 at 3:34 PM, Alister wrote: > On Fri, 29 Jun 2012 09:03:22 -0600, Littlefield, Tyler wrote: > >> On 6/29/2012 1:31 AM, Steven D'Aprano wrote: >>> On Thu, 28 Jun 2012 20:58:15 -0700, alex23 wrote: >>> On Jun 29, 12:57 pm, "Littlefield, Tyler" wrote: > I was curious if

Re: Best data structure for DFS on large graphs

2012-07-03 Thread Dan Stromberg
On Tue, Jul 3, 2012 at 3:08 PM, Miheer Dewaskar wrote: > On Tue, Jul 3, 2012 at 8:10 PM, Tim Chase > wrote: > I want it to be a generic Game solver.So the number of states depends > on the game. > Keep in mind that it would probably be a generic game solver for games that have simple board evalu

Re: code review

2012-07-03 Thread Mark Lawrence
On 03/07/2012 16:53, Chris Angelico wrote: On Wed, Jul 4, 2012 at 1:50 AM, Mark Lawrence wrote: On 03/07/2012 03:25, John O'Hagan wrote: On Tue, 3 Jul 2012 11:22:55 +1000 I agree to some extent, but as a counter-example, when I was a child there a subject called "Weights and Measures" which

Re: code review

2012-07-03 Thread Mark Lawrence
On 03/07/2012 07:09, Dennis Lee Bieber wrote: On 03 Jul 2012 04:11:22 GMT, Steven D'Aprano declaimed the following in gmane.comp.python.general: One of my favourites is the league, which in the Middle Ages was actually defined as the distance that a man, or a horse, could walk in an hour.

Re: code review

2012-07-03 Thread Chris Angelico
On Wed, Jul 4, 2012 at 1:50 AM, Mark Lawrence wrote: > On 03/07/2012 03:25, John O'Hagan wrote: >> >> On Tue, 3 Jul 2012 11:22:55 +1000 >> >> I agree to some extent, but as a counter-example, when I was a child there >> a subject called "Weights and Measures" which is now redundant because of >> t

Re: code review

2012-07-03 Thread Mark Lawrence
On 03/07/2012 03:25, John O'Hagan wrote: On Tue, 3 Jul 2012 11:22:55 +1000 I agree to some extent, but as a counter-example, when I was a child there a subject called "Weights and Measures" which is now redundant because of the Metric system. I don't miss hogsheads and fathoms at all. John I

Re: Best data structure for DFS on large graphs

2012-07-03 Thread Miheer Dewaskar
On Tue, Jul 3, 2012 at 8:10 PM, Tim Chase wrote: > On 07/03/12 08:39, Miheer Dewaskar wrote: >> On Tue, Jul 3, 2012 at 4:53 PM, Stefan Behnel wrote: >>> >>> Miheer Dewaskar, 03.07.2012 13:11: I am not sure,but if there are large number of states Dictionaries wont help much right? >>> >>

Re: Best data structure for DFS on large graphs

2012-07-03 Thread Tim Chase
On 07/03/12 08:39, Miheer Dewaskar wrote: > On Tue, Jul 3, 2012 at 4:53 PM, Stefan Behnel wrote: >> >> Miheer Dewaskar, 03.07.2012 13:11: >>> I am not sure,but if there are large number of states Dictionaries wont >>> help much right? >> >> Dicts are fast for lookup, not for searching. >> > What d

Re: code review

2012-07-03 Thread John O'Hagan
On Mon, 2 Jul 2012 22:10:00 -0700 (PDT) rusi wrote: > On Jul 3, 7:25 am, John O'Hagan wrote: > > > > I agree to some extent, but as a counter-example, when I was a child there > > a subject called "Weights and Measures" which is now redundant because of > > the Metric system. I don't miss hogshe

Re: Best data structure for DFS on large graphs

2012-07-03 Thread Miheer Dewaskar
On Tue, Jul 3, 2012 at 4:53 PM, Stefan Behnel wrote: > > Miheer Dewaskar, 03.07.2012 13:11: > > I am not sure,but if there are large number of states Dictionaries wont > > help much right? > > Dicts are fast for lookup, not for searching. > What do you mean by searching in the context of Dicts? >

Re: How can i do python form post request?

2012-07-03 Thread Thomas Jollans
On 07/03/2012 02:32 PM, gmspro wrote: > @Thomas, > >>First, you need to tell the web server to execute your Python script. > What you do next depends on how you've done that. > >>The simplest way is probably to pub p.py in your cgi-bin directory. This > could be in /var/www/cgi-bin or elsewhere,

Re: WxSlider Mouse Wheel Resolution

2012-07-03 Thread Wanderer
On Monday, July 2, 2012 6:53:36 PM UTC-4, Dennis Lee Bieber wrote: > On Mon, 2 Jul 2012 08:45:49 -0700 (PDT), Wanderer > declaimed the following in > gmane.comp.python.general: > > > Is there a way to set the mouse wheel resolution for the wxPython > > wx.Slider? I would like to use the graphic s

Re: code review

2012-07-03 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > On 03 Jul 2012 04:11:22 GMT, Steven D'Aprano > declaimed the following in > gmane.comp.python.general: > > > > One of my favourites is the league, which in the Middle Ages was actually > > defined as the distance that a man, or a horse, could walk in a

Re: How can i do python form post request?

2012-07-03 Thread gmspro
@Thomas, >First, you need to tell the web server to execute your Python script. What you do next depends on how you've done that. >The simplest way is probably to pub p.py in your cgi-bin directory. This could be in /var/www/cgi-bin or elsewhere, like /usr/lib/cgi-bin. You may need to enable CGI,

Re: Dictless classes

2012-07-03 Thread Roy Smith
In article , Duncan Booth wrote: > Also you cannot create a subclass of 'type' with non-empty slots (it throws > a type error "nonempty __slots__ not supported for subtype of 'type'"). > However I don't think that's really relevant as even if they did allow you > to use __slots__ it wouldn't

Re: code review

2012-07-03 Thread Neil Cerutti
On 2012-07-02, Chris Angelico wrote: > On Tue, Jul 3, 2012 at 1:57 AM, Rick Johnson > wrote: >> Poor Chris. That's because you've been brainwashed into believing you >> must spoon feed your interpreter to get your code working correctly. >> Stop applying these naive assumptions to Python code. Pyt

Re: Best data structure for DFS on large graphs

2012-07-03 Thread Stefan Behnel
Miheer Dewaskar, 03.07.2012 13:11: > I want to make a combinatorial game solver in python.The algorithm is to > perform Depth First Search (DFS) on the states of the game. > For DFS I,would need to keep a record of the visited states.What is the > best data structure for it,keeping in mind that the

Best data structure for DFS on large graphs

2012-07-03 Thread Miheer Dewaskar
I want to make a combinatorial game solver in python.The algorithm is to perform Depth First Search (DFS) on the states of the game. For DFS I,would need to keep a record of the visited states.What is the best data structure for it,keeping in mind that the number of states could be large? I was th

Re: Dictless classes

2012-07-03 Thread Duncan Booth
Steven D'Aprano wrote: > You can create instances without a __dict__ by setting __slots__: That is a necessary but not a sufficient condition. An instance of a class can be created without a dict only if (either you set __slots__ or you implement it in C without a __dict__ attribute) AND none

Re: How can i do python form post request?

2012-07-03 Thread Thomas Jollans
On 07/03/2012 07:08 AM, gmspro wrote: > > form.html: > > > > > > p.py: > #!/usr/bin/python > > #what to write here... > > Both files are put in /var/www/ , now from http://localhost/form.html, > if i click the submit button would i execute the p.py and how can i get > the value of textbo

Evolution (was: code review)

2012-07-03 Thread Ian Kelly
On Mon, Jul 2, 2012 at 1:35 PM, Rick Johnson wrote: > I am reminded of a story: A few years back a very nice old woman > offered to give me her typewriter. She said: "i might need to type a > letter one day and it would good to have around". It was a nice > typewriter for 1956, but she had no idea