Since when is elegance a dirty word?
Elegance is the soul of good programming. A simple and graceful
solution to the widest number of cases, efficient and easy to
understand in application. Sometimes subtle, but always beautiful.
In language design, software architecture, algorithms, it is the
When I run the following code,
script kept running and I have to force it to stop.
Could you check the code to give suggestions how to improve it?
Thanks a lot!
from Tkinter import *
from Tkinter import _cnfmerge
class Dialog(Widget):
def __init__(self, master=None, cnf={}, **kw):
cnf = _
What kind of improvement you looking for?
On 10/29/05, Shi Mu <[EMAIL PROTECTED]> wrote:
> When I run the following code,
> script kept running and I have to force it to stop.
> Could you check the code to give suggestions how to improve it?
> Thanks a lot!
>
> from Tkinter import *
> from Tkinter
move the bottom codes to the top and try to make
the codes following if __name__ == '__main__':
as few as possible.
also,
i want the main menu come first, and after clicking test/just try, i
can go to the "how are you" interface.
On 10/29/05, Liam Clarke <[EMAIL PROTECTED]> wrote:
> What kind of i
Hi,
Im trying to write a threaded chat server, building on examples given in
the book "Python Network Programming", chapter 21.
I have managed to come up with af working (so it seems) solution, see
code below.
My question is: What is wrong with this aproach?
I put each new connection in a co
There's some extra info here:
http://comments.gmane.org/gmane.comp.python.announce/5658
HTH,
Matt
--
Dr. M. Williams MRCP(UK)
Clinical Research Fellow
Cancer Research UK
+44 (0)207 269 2953
+44 (0)7834 899570
http://acl.icnet.uk/~mw
http://adhominem.blogspot.com
> When I run the following code,
> script kept running and I have to force it to stop.
Yep. Thats usually what happens when you run a GUI program.
What did you expect it to do?
> Could you check the code to give suggestions how to improve it?
I'll add some comments but its not clear what you are
I was just about to attempt to install the python mysql package
(http://sourceforge.net/projects/mysql-python/). I just wanted to know
if anyone has attempted this on OS X 10.4. Searching the list it is
very possible on past versions of os x no one seems to have commented
on the latest version thou
Alan Gauld wrote:
>> messing about with classes I've come across something basic that I
>> don't understand.
>
>
> As you say this has nothing to do with classes its more basic. Its
> about namespaces. Try reading the namespaces topic in my tutor for
> more info.
>
> Meanwhile lets simplify by
Title: Message
The "odds" are determined by the number of favorable
outcomes to the number of unfavorable outcomes. In the case of flipping a
coin, the odds are 1/1 (sometimes written as 1:1) for heads. The
_probability_ of an event (as per a "frequency" definition) is the number of
favorabl
Hi
I'm on my first day with python2.3 on Windows XP. I'm able to run
python interactively.
I've created a text file using NotePad, named it spam.py (as per
O'REILLY Learning Python, p13) contents as folows
import sys
print sys.argv
If I do:
>python spam.py
it says can't open file 'spam.p
Michael Rowan wrote:
> Hi
>
> I'm on my first day with python2.3 on Windows XP. I'm able to run
> python interactively.
>
> I've created a text file using NotePad, named it spam.py. If I do:
>
> >python spam.py
>
> it says can't open file 'spam.py'
>
> Anyone know why? I can open the file
On Thu, 27 Oct 2005, CPIM Ronin wrote:
> When using IDLE, after hitting F5 to save and run, if an error occurs,
> it merely flashes at the code location of the error. While I usually
> figure out what is wrong, why don't I get the detailed text error
> messages that the command line gives?
>
> A
On Fri, 28 Oct 2005, Johan Geldenhuys wrote:
> After I tested the previous code, I noticed that the odds is 1:49 that a
> duplicate number can be found in the 6 digit range (and it happended)
> and that 0 can also be found.
Hi Johan,
I'm not exactly sure how 1 in 49 are the odds of getting a d
> ##
> >>> count_duplicates = 0
> >>> for i in range(10):
> ... if has_duplication(make_roll(50, 6)):
> ... count_duplicates = count_duplicates + 1
> ...
> >>> count_duplicates
> 1
> >>> 1.0 / 10
> 0.10001
> ##
>
>
> Experimentally, we're seeing 1%, but that might j
Sorry about misposting this here. I always mix up the
tutor@ and edu-sig@ lists. I am just going to follow
up two things that seem tutor related.
If this seems interesting, you may want to join the
edu-sig list for more...
>>More frightening to me than the ubiquitous use of MS Office is the
>>o
> > I agree. When writing for keeps (i.e. production code) I prefer
> > clarity and ease of maintenance over 'elegance' or 'trickiness'.
> > This exercise is intended, in part, to sharpen my understanding of
> > Python idioms. If I can write highly idiomatic code that works,
> > chances are bett
Sorry. *blush* That was some late Friday night craziness. I just
looked at the code being discussed:
retList=[word[pos]+item for item in permute3(word[0:pos]+word[pos+1:])]
And really didn't want to anybody to confuse that with Python's idea
of elegance.
List comprehensions can get pretty hor
18 matches
Mail list logo