Re: Odd behavior in Python/Tkinter?

2007-12-22 Thread Lie
On Dec 22, 1:42 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: Lie wrote: Inspect the following code: --- start of code --- import Tkinter as Tk from Tkconstants import * root = Tk.Tk() e1 = Tk.Entry(root, text = 'Hello World') e2 = Tk.Entry(root, text = 'Hello World') the text (or

Re: exception message output problem

2007-12-22 Thread Lie
On Dec 22, 6:18 am, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Lie a écrit : (snip) # Python have an odd (read: broken) singleton implementation # single member tuple must have a comma behind it You may call it weird or even a wart if you want, but given that what makes the tuple is

Re: How to get Python to default to UTF8

2007-12-22 Thread weheh
Hi Fredrik, thanks for responding. After reading up some more on this, I think my title should be changed to How to get Python to default to ASCII. In point of fact, I want my 2 environments to agree so that I can debug thinkgs more easily. Right now it's a nightmare. As to your questions, in

Re: exception message output problem

2007-12-22 Thread Lie
PPS: Actually, what makes a tuple is both the parens and the comma, with comma as the minimum signifier, inspect this: str(a) + str((a,b,c)), you have to use the double parens, one to make the tuple and the other as part of the str. This harmless little case gives error if done without the double

Re: Ping Implementation in Python

2007-12-22 Thread Mrown
Roger Miller wrote: On Dec 20, 5:41 am, Mrown [EMAIL PROTECTED] wrote: Hi, I was wondering if there was a ping implementation written in Python. http://www.gnist.org/~lars/code/ping/ping.html Thanks for your replies. I'll probably start invesigating with Roger's suggestion. Scapy

Re: smtplib problem, Unable to relay for

2007-12-22 Thread Benedict Verheyen
Tim Williams schreef: snip Have you asked your Exchange admin if the server is allowed to relay via SMTP? I'm the system administrator but haven't really checked the config since i didn't know this type of email sending was considered relaying. If your working mail program is Outlook then

Re: Passing by reference

2007-12-22 Thread Hendrik van Rooyen
MartinRinehart Wrote: More seriously, I can and do use lots of globals. In the tokenizer I'm writing, for example, all the token types(COMMENT_EOL = 0, CONSTANT_INTEGER = 1, ...) are global constants. The text to be tokenized is a global variable. (Actually, the text is unchanging once the

Re: How to handle multi-line quotes

2007-12-22 Thread Hendrik van Rooyen
MartinRinehart wrote: Thinking about unclosed multi-line quotes. When you open a multi-line quote (type '') what does your editor do? Does it color the remainder of your text as a quote, or does it color the line with the open quote as a quote and leave the rest of your code alone? What

twisted/qt main loop integration

2007-12-22 Thread Anton Tropashko
i can't use qtreactor since it relies on qt bindings lib (GPLed) how much work there is to provide an alternative gpl free qtreactor equivalent that is suitable for deployment in a commercial app and who is specializing in this sort of contract work? in case i can convince the management to get

Re: twisted/qt main loop integration [email]

2007-12-22 Thread Anton Tropashko
Anton Tropashko wrote: i can't use qtreactor since it relies on qt bindings lib (GPLed) how much work there is to provide an alternative gpl free qtreactor equivalent that is suitable for deployment in a commercial app and who is specializing in this sort of contract work? in case i can

Re: 2.5.1 rpms?

2007-12-22 Thread Anton Tropashko
gamename wrote: Hi, Where can I find python 2.5.1 rpm's for redhat9 and fedora6/7? did you check on the fedora7 dvd? btw building from sources if completely straigtforward (meaning that it does not build character and leaves your with a sense of accomplishment the way building x.org code

Re: twisted/qt main loop integration [email]

2007-12-22 Thread Phil Thompson
On Saturday 22 December 2007, Anton Tropashko wrote: Anton Tropashko wrote: i can't use qtreactor since it relies on qt bindings lib (GPLed) how much work there is to provide an alternative gpl free qtreactor equivalent that is suitable for deployment in a commercial app and who is

Performance on local constants?

2007-12-22 Thread William McBrine
Hi all, I'm pretty new to Python (a little over a month). I was wondering -- is something like this: s = re.compile('whatever') def t(whatnot): return s.search(whatnot) for i in xrange(1000): print t(something[i]) significantly faster than something like this: def t(whatnot): s

Re: Odd behavior in Python/Tkinter?

2007-12-22 Thread Lie
But an expression (e.g. string) is NOT a variable. It's fine if the value mirrored when I set the textvariable conf to the same variable, but in this case I'm setting them to the same expression (e.g. string). On the other hand, the oddness multiplied since the value replication doesn't happen

Re: Performance on local constants?

2007-12-22 Thread Paddy
On Dec 22, 10:53 am, William McBrine [EMAIL PROTECTED] wrote: Hi all, I'm pretty new to Python (a little over a month). I was wondering -- is something like this: s = re.compile('whatever') def t(whatnot): return s.search(whatnot) for i in xrange(1000): print t(something[i])

Re: Performance on local constants?

2007-12-22 Thread John Machin
On Dec 22, 9:53 pm, William McBrine [EMAIL PROTECTED] wrote: Hi all, I'm pretty new to Python (a little over a month). I was wondering -- is something like this: s = re.compile('whatever') def t(whatnot): return s.search(whatnot) for i in xrange(1000): print t(something[i])

Re: Performance on local constants?

2007-12-22 Thread Duncan Booth
William McBrine [EMAIL PROTECTED] wrote: Hi all, I'm pretty new to Python (a little over a month). I was wondering -- is something like this: s = re.compile('whatever') def t(whatnot): return s.search(whatnot) for i in xrange(1000): print t(something[i]) significantly

Re: Passing by reference

2007-12-22 Thread MartinRinehart
Hendrik van Rooyen wrote: I wonder if you have some COBOL data divisions under your belt? Hendrik, I go way back but somehow I missed COBOL. Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing by reference

2007-12-22 Thread MartinRinehart
Bruno Desthuilliers wrote: ... that's definitively not something I'd store in global. So where would you put it? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to in Python

2007-12-22 Thread MartinRinehart
Chris Mellon wrote: You don't seem to be implementing the lexer in Python I am absolutely implementing my language in Python, a language I have now been writing for two entire weeks. This list has been more than helpful, tolerating numerous newbie questions. --

Re: Performance on local constants?

2007-12-22 Thread Steven D'Aprano
On Sat, 22 Dec 2007 10:53:39 +, William McBrine wrote: Hi all, I'm pretty new to Python (a little over a month). I was wondering -- is something like this: s = re.compile('whatever') def t(whatnot): return s.search(whatnot) for i in xrange(1000): print t(something[i])

Re: Odd behavior in Python/Tkinter?

2007-12-22 Thread Fredrik Lundh
Lie wrote: But an expression (e.g. string) is NOT a variable. in this case, it is. I don't know if it's worth spending more time on this, since you're not listening, but let's make one more attempt. for the Entry widget, the textvariable argument, if given, identifies an *internal* Tkinter

fiber(cooperative multi-threading)

2007-12-22 Thread Akihiro KAYAMA
Hi all. I found cooperative multi-threading(only one thread runs at once, explicit thread switching) is useful for writing some simulators. With it, I'm able to be free from annoying mutual exclusion, and make results deterministic. For this purpose, and inspired by Ruby(1.9) fiber, I wrote my

disabling button

2007-12-22 Thread [EMAIL PROTECTED]
using tkinter i created a gui and put a button on the frame class mygui: def __init__(self, parent): ... self.okButton = Button(self.btnFrame) self.okButton.configure(width=somewdth,text=OK, anchor=W,disabledforeground=tan)

Re: Odd behavior in Python/Tkinter?

2007-12-22 Thread Lie
On Dec 22, 7:35 pm, Fredrik Lundh [EMAIL PROTECTED] wrote: Lie wrote: But an expression (e.g. string) is NOT a variable. in this case, it is.  I don't know if it's worth spending more time on this, since you're not listening, but let's make one more attempt. Sure I'm listening (well,

Re: How to get Python to default to UTF8

2007-12-22 Thread Fredrik Lundh
weheh wrote: Hi Fredrik, thanks for responding. After reading up some more on this, I think my title should be changed to How to get Python to default to ASCII. In point of fact, I want my 2 environments to agree so that I can debug thinkgs more easily. Right now it's a nightmare. As to

Re: Passing by reference

2007-12-22 Thread Steven D'Aprano
On Sat, 22 Dec 2007 04:13:31 -0800, MartinRinehart wrote: Bruno Desthuilliers wrote: ... that's definitively not something I'd store in global. So where would you put it? Context is all gone, so I'm not sure that I remember what it is. I think it is the text that you're parsing. I

Re: Detecting memory leaks on apache, mod_python

2007-12-22 Thread Steven D'Aprano
On Sat, 22 Dec 2007 08:09:50 +0100, Fredrik Lundh wrote: Steven D'Aprano wrote: Not me. You're quite knew to this internet thing, aren't you? ;-) :-D So... how do you measure memory usage in Python? Every programming language I've used before (not a huge range, I'll admit) had

Pure Python GUI lib?

2007-12-22 Thread oyster
For the word Pure, I mean it is not a C/C++/Z++.. extension, so that we can use it under pythons of different version. Is it possible? I don't like to update the module for different python and the module Currently, I am writing the interface to iup(http://www.tecgraf.puc-rio.br/iup) via ctypes,

Re: Why does __builtins__ mean different things...

2007-12-22 Thread Dustan
On Dec 21, 8:11 pm, James Stroud [EMAIL PROTECTED] wrote: I swear there is another thread going on here of which I am not aware. You just keep on telling yourself that. -- http://mail.python.org/mailman/listinfo/python-list

Re: exception message output problem

2007-12-22 Thread Fredrik Lundh
Russ P. wrote: Actually, the parens aren't needed, so this works too: def __init__(self, args=): self.args = args, The trailing comma wasn't necessary a while back (pre 2.5?), so something in Python must have changed. I'd say that it looks a bit cleaner without the trailing comma, so

Re: Performance on local constants?

2007-12-22 Thread Dustan
On Dec 22, 6:04 am, John Machin [EMAIL PROTECTED] wrote: t3 = re.compile('whatever').search Ack! No! Too Pythonic! GETITOFF! GETITOFF!! -- http://mail.python.org/mailman/listinfo/python-list

Re: disabling button

2007-12-22 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: then in the buttonClick(self,event) i want to disable it till some time consuming calculations are completed ..then i enable it def button1Click(self, event): self.okButton.configure(state=DISABLED) +

Re: fiber(cooperative multi-threading)

2007-12-22 Thread Arnaud Delobelle
On Dec 22, 12:10 pm, Akihiro KAYAMA [EMAIL PROTECTED] wrote: Hi all. I found cooperative multi-threading(only one thread runs at once, explicit thread switching) is useful for writing some simulators. With it, I'm able to be free from annoying mutual exclusion, and make results

Re: disabling button

2007-12-22 Thread [EMAIL PROTECTED]
an explicit call to update_idletasks will clear out the task queue for you. /F it worked Thanks F.L!! dn -- http://mail.python.org/mailman/listinfo/python-list

Re: Pure Python GUI lib?

2007-12-22 Thread Martin v. Löwis
For the word Pure, I mean it is not a C/C++/Z++.. extension, so that we can use it under pythons of different version. Is it possible? The python-xlib project provides such a module. It implements the X11 protocol directly. Regards, Martin --

Re: Detecting memory leaks on apache, mod_python

2007-12-22 Thread Fredrik Lundh
Steven D'Aprano wrote: Not me. You're quite knew to this internet thing, aren't you? ;-) :-D (hmm. why is that whenever you make some silly last-second addition to a post, you end up making a stupid typo?) And things like how much memory is free in the heap isn't even a meaningful

Re: The 0.8181818181... Truth Movement

2007-12-22 Thread Phil Carmody
On 1117th December 2004, Dustan [EMAIL PROTECTED] wrote: I must break my promise and make another post. On Dec 22, 2:31 am, Proginoskes [EMAIL PROTECTED] wrote: On Dec 20, 4:29 pm, Dustan [EMAIL PROTECTED] wrote: On Dec 20, 8:24 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote:

Re: fiber(cooperative multi-threading)

2007-12-22 Thread Duncan Booth
Arnaud Delobelle [EMAIL PROTECTED] wrote: I am not really familiar with ruby but these fibers seem to be some sort of coroutines. Since python 2.5, generators can be sent values, this can be used to implement what you want. I have had a got at it for fun and this is what I came up with:

Re: exception message output problem

2007-12-22 Thread Mel
Lie wrote: PPS: Actually, what makes a tuple is both the parens and the comma, with comma as the minimum signifier, inspect this: str(a) + str((a,b,c)), you have to use the double parens, one to make the tuple and the other as part of the str. This harmless little case gives error if done

Re: fiber(cooperative multi-threading)

2007-12-22 Thread Arnaud Delobelle
On Dec 22, 2:37 pm, Duncan Booth [EMAIL PROTECTED] wrote: Arnaud Delobelle [EMAIL PROTECTED] wrote: I am not really familiar with ruby but these fibers seem to be some sort of coroutines.  Since python 2.5, generators can be sent values, this can be used to implement what you want.  I have

Twisted: UDP socket not closed.

2007-12-22 Thread Kevac Marko
Hi. I have to send UDP packets very often. Approx twice in a second. But socket is not closed after sending packet. So soon i bump into open sockets\files limit. How to close socket after sending data? Python 2.5, Twisted class DataClient(DatagramProtocol): def __init__(self, address,

Re: 3D plotting with python 2.5 on win32

2007-12-22 Thread gsal
On Dec 20, 1:24 pm, Peter Wang [EMAIL PROTECTED] wrote: On a side note, we are almost done putting together an updated one- click installer of python + packages for scientific computing.  This will be based on Python 2.5, will include most of what was included in the 2.4.3-based installer,

Re: smtplib problem, Unable to relay for

2007-12-22 Thread Grant Edwards
On 2007-12-21, Benedict Verheyen [EMAIL PROTECTED] wrote: i get an Unable to relay for when trying to send an email from within my network to an email address not on my domain. I don't understand why it says relaying as i'm sending from an internal domain user to an external user. You're

Re: Is there a simple way to parse this string ?

2007-12-22 Thread [EMAIL PROTECTED]
Steven D'Aprano, On Dec 21, 2:08 am, Steven D'Aprano [EMAIL PROTECTED] wrote: On Thu, 20 Dec 2007 20:27:23 -0800, [EMAIL PROTECTED] wrote: Stef, For clarification, there is nothing hazardous about using eval on the string that you presented. t = eval('(0, 0, 0, 255), (192, 192, 192,

$$$$ HONEST MONEY MAKING $$$$

2007-12-22 Thread Shirley
No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.17.6/1192 - Release Date: 12/21/2007 1:17 PM -- http://mail.python.org/mailman/listinfo/python-list

Re: Newbie question - what's the term for input/output to a web page?

2007-12-22 Thread Rachel Garrett
Thanks to both. The web page I am trying to work with happens to be .aspx, so there is lots of junk to wade through -- no clear way to tell my program how to submit information to the page. I will keep looking, though. -- http://mail.python.org/mailman/listinfo/python-list

Re: Detecting memory leaks on apache, mod_python

2007-12-22 Thread Ilias Lazaridis
On 22 Δεκ, 09:09, Fredrik Lundh [EMAIL PROTECTED] wrote: [...] For Python, standard process monitoring tools (combined with a basic understanding of how dynamic memory allocation works on modern platforms) are usually sufficient to get a good view of an application's memory usage patterns.

Re: Best way to protect my new commercial software.

2007-12-22 Thread Hendrik van Rooyen
Dennis Lee Bieber ...netcom.com wrote: SD declaimed the following in comp.lang.python: At 15-35 lines, it is short enough for people to copy it down on paper, or even memorize it, then take it home and work on finding a vulnerability in it. heh I'd actually been thinking of the

gtk.TreeView cell inconsistent state

2007-12-22 Thread [EMAIL PROTECTED]
In the below code setting cell to inconsistent sets entire column inconsistent (renderer).However, I need a third state off | on | inconsistent . How can I change one path-cell? Any help appreciated. Thanks john # get current value fixed = model.get_value(iter,

Seperate Files

2007-12-22 Thread katie smith
I'm attempting to create a game and right now the game has 6000 lines of code and is confusing me. I have seen it done but have no idea how to do it, but I would like to use seperate files and incorporate them together. One for my units, one for the map maker, one for the playing part. Any

doctest + sqlobject (TDD)

2007-12-22 Thread petr . jakes . tpc
Hi, inspired by the article written by Tarek Ziade in the February 07 issue of the Linux + magazine I am experimenting with the doctest module. I have two files, displeje_pokus.py and displeje_pokus.txt (you can see the simplified contents of the files bellow). When I run python

Re: Seperate Files

2007-12-22 Thread Fredrik Lundh
katie smith wrote: I'm attempting to create a game and right now the game has 6000 lines of code and is confusing me. I have seen it done but have no idea how to do it, but I would like to use seperate files and incorporate them together. One for my units, one for the map maker, one

Re: doctest + sqlobject (TDD)

2007-12-22 Thread Peter Otten
petr.jakes.tpc wrote: Hi, inspired by the article written by Tarek Ziade in the February 07 issue of the Linux + magazine I am experimenting with the doctest module. I have two files, displeje_pokus.py and displeje_pokus.txt (you can see the simplified contents of the files bellow).

Re: disabling button

2007-12-22 Thread damonjulian
if you disable the button it can still respond to clicks? it only greys out.. or is there a problem with my code here? class MyApp: def __init__(self,parent): self.mainframe=Frame(parent) self.mainframe.pack()

Re: The 0.8181818181... Truth Movement

2007-12-22 Thread David Bernier
Proginoskes wrote: On Dec 20, 4:29 pm, Dustan [EMAIL PROTECTED] wrote: On Dec 20, 8:24 am, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Thu, 20 Dec 2007 03:04:48 -0800, Dustan wrote: On Dec 20, 1:05 am, Proginoskes [EMAIL PROTECTED] wrote: I myself prefer the 0.81818181... Truth

Re: Performance on local constants?

2007-12-22 Thread Terry Reedy
Steven D'Aprano [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | def spam2(x, s=re.compile('nobody expects the Spanish Inquisition!')): | ... return s.search(x) | | I suspect that this will be not only the fastest solution, but also the | most flexible. 'Most flexible' in a

Re: Pure Python GUI lib?

2007-12-22 Thread kyosohma
On Dec 22, 7:31 am, oyster [EMAIL PROTECTED] wrote: For the word Pure, I mean it is not a C/C++/Z++.. extension, so that we can use it under pythons of different version. Is it possible? I don't like to update the module for different python and the module Currently, I am writing the

Re: doctest + sqlobject (TDD)

2007-12-22 Thread petr . jakes . tpc
On Dec 22, 7:05 pm, Peter Otten [EMAIL PROTECTED] wrote: petr.jakes.tpc wrote: While you could either alter the textfile to import __main__ as displeje_pokus or the module along the lines of # not recommended! from displeje_pokus import TextyDispleje if __name__ == __main__: #

Tcl/Tk 8.5.0 released

2007-12-22 Thread Kevin Walzer
Thought this might interest some... http://www.osnews.com/story.php/19073/TclTk-8.5-Released The relevant bits for Python here are the major improvements in Tk, specifically native themed widgets for full platform integration on Windows and OS X and improved appearance under X11, additonal

5 queens

2007-12-22 Thread cf29
Greetings, I designed in JavaScript a small program on my website called 5 queens. (http://www.cf29.com/design/dame5_eng.php) The goal is to control all the chess board with five queens that do not attack each other. I found manually many solutions to this problem (184 until now) and wanted to

How do i scale my axes in matplotlib?

2007-12-22 Thread Eric Holbrook
I'm using matplotlib to generate (and save) plots of bandwidth data from simulation logs. Since the simulations are of varying lengths, i need a way to scale the axes so that every 100,000 points on the X-axis are roughly equal to the height of the Y-axis. In other words, if my X data varied from

Re: Why does __builtins__ mean different things...

2007-12-22 Thread James Stroud
Dustan wrote: On Dec 21, 8:11 pm, James Stroud [EMAIL PROTECTED] wrote: I swear there is another thread going on here of which I am not aware. You just keep on telling yourself that. Is there a cricket here? -- James Stroud UCLA-DOE Institute for Genomics and Proteomics Box 951570 Los

Re: doctest + sqlobject (TDD)

2007-12-22 Thread Peter Otten
petr.jakes.tpc wrote: thanks for your reply. I will try to live with the import __main__ as displeje_pokus in the text file. Why? Anyway, using this, it looks like I have to assign all functions/ methods to a local name like: myFunction=displeje_pokus.myFunction to avoid to

Re: Inter-process communication, how?

2007-12-22 Thread Nikita the Spider
In article [EMAIL PROTECTED], [EMAIL PROTECTED] wrote: Hi, let's say I have two scripts: one does some computations and the other one is a graphical front end for launching the first one. And both run in separate processes (front end runs and that it spawns a subprocess with the

Re: doctest + sqlobject (TDD)

2007-12-22 Thread petr . jakes . tpc
Thanks, it works. And thanks for your comments which are worth to think about :) Petr This has nothing to do with your previous problem. Use from __main__ import myFunction, myOtherFunction, ... or from __main__ import * if you prefer namespace pollution paradise*. Again, it would be

Re: Performance on local constants?

2007-12-22 Thread John Machin
On Dec 23, 5:38 am, Terry Reedy [EMAIL PROTECTED] wrote: Steven D'Aprano [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | def spam2(x, s=re.compile('nobody expects the Spanish Inquisition!')): | ... return s.search(x) | | I suspect that this will be not only the fastest

Output buffer

2007-12-22 Thread Cesar D. Rodas
Hello I am newbie in Python, but I like it very much. Right now I am having a problem, I am working with mod_python in apache. What I needing is a stdout buffering, that means that everything that I send to stdout keep it in a variable, then flush it and clear. Thanks in advance. -- Best

Re: exception message output problem

2007-12-22 Thread Bruno Desthuilliers
Lie a écrit : PPS: Actually, what makes a tuple is both the parens and the comma, Nope, it's definively the comma. You can check the language's grammar, it's part of the doc. Or just test FWIW: Python 2.4.3 (#1, Mar 12 2007, 23:32:01) [GCC 3.3.4 20040623 (Gentoo Linux 3.3.4-r1, ssp-3.3.2-2,

Re: exception message output problem

2007-12-22 Thread Bruno Desthuilliers
Lie a écrit : On Dec 22, 6:18 am, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Lie a écrit : (snip) # Python have an odd (read: broken) singleton implementation # single member tuple must have a comma behind it You may call it weird or even a wart if you want, but given that what makes the

Re: Passing by reference

2007-12-22 Thread MartinRinehart
Steven D'Aprano wrote: Context is all gone, so I'm not sure that I remember what it is. I think it is the text that you're parsing. Yes. I'm tokenizing today. Parsing comes after Christmas. TEXT = placeholder def parse(): while True: token = get_next_token() # looks at

Re: Newbie question - what's the term for input/output to a web page?

2007-12-22 Thread Bruno Desthuilliers
Rachel Garrett a écrit : Thanks to both. The web page I am trying to work with happens to be .aspx, so there is lots of junk to wade through -- no clear way to tell my program how to submit information to the page. I will keep looking, though. You don't submit information to a page, you

Re: Is this a bug in int()?

2007-12-22 Thread MartinRinehart
Tokenizer accepts 0x as zero. Spec says its an error not to have at least one hex digit after 0x. This is a more serious bug than I had originally thought. Consider this: Joe types security_code = 0x and then goes off to the Guardian-of- the-Codes to get the appropriate hex string. Returning to

Re: Passing by reference

2007-12-22 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : Bruno Desthuilliers wrote: ... that's definitively not something I'd store in global. So where would you put it? You don't have to put functions arguments anywhere - they're already local vars. def tokenize(text): do some work returns or (yields) a

Re: 5 queens

2007-12-22 Thread Michael Spencer
cf29 wrote: Greetings, I designed in JavaScript a small program on my website called 5 queens. .. Has anyone tried to do a such script? If anyone is interested to help I can show what I've done so far. Tim Peters has a solution to 8 queens in test_generators in the standard library

Re: 5 queens

2007-12-22 Thread John Machin
On Dec 23, 8:05 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Sat, 22 Dec 2007 11:36:07 -0800 (PST), cf29 [EMAIL PROTECTED] declaimed the following in comp.lang.python: Greetings, I designed in JavaScript a small program on my website called 5 queens. Only 5? The classic

Re: Output buffer

2007-12-22 Thread Fredrik Lundh
Cesar D. Rodas wrote: I am newbie in Python, but I like it very much. Right now I am having a problem, I am working with mod_python in apache. What I needing is a stdout buffering, that means that everything that I send to stdout keep it in a variable, then flush it and clear. plug in a

Re: How do i scale my axes in matplotlib?

2007-12-22 Thread Emmanuel
On Dec 22, 5:42 pm, Eric Holbrook [EMAIL PROTECTED] wrote: I'm using matplotlib to generate (and save) plots of bandwidth data from simulation logs. Since the simulations are of varying lengths, i need a way to scale the axes so that every 100,000 points on the X-axis are roughly equal to the

Re: 5 queens

2007-12-22 Thread cf29
On Dec 22, 11:05 pm, Dennis Lee Bieber [EMAIL PROTECTED] wrote:         Only 5? The classic algorithm is 8-queens on a standard 8x8 board, as I recall... This is a different problem. You have to control all the squares with only 5 queens. In the 8 queens problem you have to put 8 safe queens. I

Re: 5 queens

2007-12-22 Thread Jervis Liang
On Dec 22, 2:36 pm, cf29 [EMAIL PROTECTED] wrote: The goal is to control all the chess board with five queens that do not attack each other. I found manually many solutions to this problem (184 until now) How did you find 184 solutions? Wolfram says there are 91 distinct solutions for

Re: 5 queens

2007-12-22 Thread Fredrik Lundh
Michael Spencer wrote: Tim Peters has a solution to 8 queens in test_generators in the standard library test suite (see: Lib/test/test_generators.py) and for a more straightforward and perhaps more grokkable implementation, see Guido's original Python demo code in Demo/scripts/queens.py

[Python API] execution environment regarding embedded python

2007-12-22 Thread Christiaan Putter
Hi there guys and girls, I'm new (like many people I guess) to python and embedded python and have been struggling to get c++ and python to play nicely for the past couple of weeks. Up till now I've overcome most obstacles by rtfm, but there are still a few things I don't get. My setup:

OMG please help

2007-12-22 Thread katie smith
Here is the program I just started, The problem i am having is I'm trying to get it to load the image file Sand1 with eval(loader) = pygame.image.load(loader) because Loader is euqual to Sand1 but It wont load it. If I set it as loader = pygame.image.load(loader) then it sets the image to the

Re: 5 queens

2007-12-22 Thread cf29
On Dec 23, 12:39 am, Jervis Liang [EMAIL PROTECTED] wrote: On Dec 22, 2:36 pm, cf29 [EMAIL PROTECTED] wrote: The goal is to control all the chess board with five queens that do not attack each other. I found manually many solutions to this problem (184 until now) How did you find 184

Re: The 0.8181818181... Truth Movement

2007-12-22 Thread Phil Carmody
Dustan [EMAIL PROTECTED] writes: On Dec 22, 8:20 am, Phil Carmody [EMAIL PROTECTED] wrote: On 1117th December 2004, Dustan [EMAIL PROTECTED] wrote: Look at the list of groups. Python's the only language in there. Python uses double precision. Period. But Professor Checkman was

Re: getattr() question

2007-12-22 Thread John Machin
On Dec 23, 10:39 am, Sledge [EMAIL PROTECTED] wrote: Hi. I am trying to dynamically load a class and attributes at run time. I do not know what classes will be referenced until run time. I have it loading the module correctly, but when I use getattr to access the class and its attributes

getattr() question

2007-12-22 Thread Sledge
Hi. I am trying to dynamically load a class and attributes at run time. I do not know what classes will be referenced until run time. I have it loading the module correctly, but when I use getattr to access the class and its attributes everything works except that I get additional unwanted

Re: 5 queens

2007-12-22 Thread John Machin
On Dec 23, 10:18 am, cf29 [EMAIL PROTECTED] wrote: On Dec 23, 12:39 am, Jervis Liang [EMAIL PROTECTED] wrote: On Dec 22, 2:36 pm, cf29 [EMAIL PROTECTED] wrote: The goal is to control all the chess board with five queens that do not attack each other. I found manually many solutions to

Re: getattr() question

2007-12-22 Thread Sledge
On Dec 22, 7:14 pm, John Machin [EMAIL PROTECTED] wrote: On Dec 23, 10:39 am, Sledge [EMAIL PROTECTED] wrote: Hi. I am trying to dynamically load a class and attributes at run time. I do not know what classes will be referenced until run time. I have it loading the module correctly,

Re: Pure Python GUI lib?

2007-12-22 Thread Andrew MacIntyre
oyster wrote: For the word Pure, I mean it is not a C/C++/Z++.. extension, so that we can use it under pythons of different version. Is it possible? I don't like to update the module for different python and the module Currently, I am writing the interface to

Re: exception message output problem

2007-12-22 Thread Lie
On Dec 23, 4:30 am, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Lie a écrit : PPS: Actually, what makes a tuple is both the parens and the comma, Nope, it's definively the comma. You can check the language's grammar, it's part of the doc. Or just test FWIW: Python 2.4.3 (#1, Mar 12 2007,

Re: 5 queens

2007-12-22 Thread cf29
On Dec 23, 1:49 am, John Machin [EMAIL PROTECTED] wrote: How did you find 184 solutions? Wolfram says there are 91 distinct solutions for 5-queens on an 8x8 board with no two queens attacking each other. It's *91* distinct solutions to what appears to be *exactly* your problem: k

Re: Is this a bug in int()?

2007-12-22 Thread George Sakkis
On Dec 22, 5:03 pm, [EMAIL PROTECTED] wrote: Tokenizer accepts 0x as zero. Spec says its an error not to have at least one hex digit after 0x. This is a more serious bug than I had originally thought. Consider this: Joe types security_code = 0x and then goes off to the Guardian-of-

Re: Detecting memory leaks on apache, mod_python

2007-12-22 Thread Steven D'Aprano
On Sat, 22 Dec 2007 13:05:23 -0800, Dennis Lee Bieber wrote: I've never encountered such items supported by the language. OS specific extensions MIGHT supply it... Picky picky... but of course you are right. When I said that programming languages I have used before had facilities to

Re: 5 queens

2007-12-22 Thread cf29
Sorry again I forgot a part of the function in my previous post: --- # add nbQueens (5) new queens on safe squares def newQueens(nbQueens=5): solution = [] # one solution for i in range(len(board)): # 64 squares

Re: Is this a bug in int()?

2007-12-22 Thread Steven D'Aprano
On Sat, 22 Dec 2007 14:03:09 -0800, MartinRinehart wrote: Tokenizer accepts 0x as zero. Spec says its an error not to have at least one hex digit after 0x. This is a more serious bug than I had originally thought. Consider this: Joe types security_code = 0x and then goes off to the

Re: Is there a simple way to parse this string ?

2007-12-22 Thread Steven D'Aprano
On Sat, 22 Dec 2007 07:21:26 -0800, [EMAIL PROTECTED] wrote: Steven D'Aprano, On Dec 21, 2:08 am, Steven D'Aprano [EMAIL PROTECTED] wrote: On Thu, 20 Dec 2007 20:27:23 -0800, [EMAIL PROTECTED] wrote: Stef, For clarification, there is nothing hazardous about using eval on the string

Re: Alternative to python -u for binary upload to cgi on windows?

2007-12-22 Thread cameron . walsh
On Dec 14, 6:58 pm, Cameron Walsh [EMAIL PROTECTED] wrote: Hi all, Using a pythoncgiscript such as the one below to handle uploaded binary files will end up with atruncatedfile (truncates when it hits ^Z) on Windows systems. On linux systems the code works and the file is nottruncated.

Inter-process communication, how? Part 2

2007-12-22 Thread ecir . hana
Hello, just to recap: last time I asked how to do an interprocess communitation, between one Manager process (graphical beckend) and some Worker processes. I decided to go with sockets, thanks for replies, once more. However, I would like to ask another thing: I would like to collect everyting

Re: exception message output problem

2007-12-22 Thread Russ P.
On Dec 22, 5:34 am, Fredrik Lundh [EMAIL PROTECTED] wrote: Russ P. wrote: Actually, the parens aren't needed, so this works too: def __init__(self, args=): self.args = args, The trailing comma wasn't necessary a while back (pre 2.5?), so something in Python must have changed. I'd

  1   2   >