Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread John Salerno
On Thursday, March 1, 2012 1:38:08 AM UTC-6, Steven D'Aprano wrote: > On Wed, 29 Feb 2012 22:41:53 -0800, John Salerno wrote: > > >> Yes. You must leave it out. > > > > Now I'm reading a Tkinter reference at > > http://infohost.nmt.edu/tcc/help/pubs/tkinter/minimal-app.html and it > > has this ex

Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!

2012-03-01 Thread Kiuhnm
On 3/1/2012 1:02, Xah Lee wrote: i missed a point in my original post. That is, when the same operator are adjacent. e.g. 「3 ▲ 6 ▲ 5」. This is pointed out by Kiuhnm 〔kiuhnm03.4t.yahoo.it〕 and Tim Bradshaw. Thanks. though, i disagree the way they expressed it, or any sense this is different from

EuroPython 2012: Call for Proposal is Open! [Please spread the word]

2012-03-01 Thread Palla
Hi all, I am writing on behalf of EuroPython Staff (www.europython.eu). We are happy to announce that the Call for Proposals is now officially open! DEADLINE FOR PROPOSALS: MARCH 18TH, 23:59:59 CET For those who have never been at EuroPython (or similar conferences) before, the Call for Proposals

exec

2012-03-01 Thread Rolf Wester
Hi, I would like to define methods using exec like this: class A: def __init__(self): cmd = "def sqr(self, x):\nreturn x**2\nself.sqr = sqr\n" exec cmd a = A() print a.sqr(a, 2) This works, but I have to call sqr with a.sqr(a, 2), a.sqr(2) does not work (TypeError: sqr()

Re: exec

2012-03-01 Thread Jean-Michel Pichavant
Rolf Wester wrote: Hi, I would like to define methods using exec like this: class A: def __init__(self): cmd = "def sqr(self, x):\nreturn x**2\nself.sqr = sqr\n" exec cmd a = A() print a.sqr(a, 2) This works, but I have to call sqr with a.sqr(a, 2), a.sqr(2) does not wo

EuroPython 2012: Call for Proposal is Open! [Please spread the word]

2012-03-01 Thread Francesco Pallanti
Hi guys, I'm Francesco and I am writing on behalf of EuroPython Staff (www.europython.eu). We are happy to announce that the Call for Proposals is now officially open! DEADLINE FOR PROPOSALS: MARCH 18TH, 23:59:59 CET For those who have never been at EuroPython (or similar conferences) before, th

Re: exec

2012-03-01 Thread Arnaud Delobelle
On 1 March 2012 13:07, Rolf Wester wrote: > Hi, > > I would like to define methods using exec like this: > > class A: >    def __init__(self): >        cmd = "def sqr(self, x):\n    return x**2\nself.sqr = sqr\n" >        exec cmd > a = A() > print a.sqr(a, 2) > > This works, but I have to call sq

Re: exec

2012-03-01 Thread Steven D'Aprano
On Thu, 01 Mar 2012 14:07:15 +0100, Rolf Wester wrote: > Hi, > > I would like to define methods using exec like this: > > class A: > def __init__(self): > cmd = "def sqr(self, x):\nreturn x**2\nself.sqr = sqr\n" > exec cmd > a = A() > print a.sqr(a, 2) That's... nasty,

Re: lang comparison: in-place algorithm for reversing a list in Perl, Python, Lisp

2012-03-01 Thread Rainer Weikusat
Xah Lee writes: [...] > # perl > # in-place algorithm for reversing a list. > > use strict; > use Data::Dumper; > use POSIX; # for “floor” > > my @listA = qw(a b c d e f g); > > my $listLength = scalar @listA; > > for ( my $i = 0; $i < floor($listLength/2); $i++ ) { > my $x = $listA[$i]; >

Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

2012-03-01 Thread Rainer Weikusat
Shmuel (Seymour J.) Metz writes: > In <87aa41k6x5@sapphire.mobileactivedefense.com>, on 02/29/2012 >at 03:15 PM, Rainer Weikusat said: > >>'mathematics' (an essentially outdated write-only programming >>language dating back to the times when humans had to perform >>computations themselv

SSL and os.system/Popen

2012-03-01 Thread Marek Lipert
Hi! I have a problem with SSL and threaded os.system (rewritten to Popen but still not working). First - the set-up: I am using windows 2003 server with current python 2.6. When new connection comes to my server-side application, i do accept, and then: self.client = ssl.wrap_socket(self.soc

Re: exec

2012-03-01 Thread Rolf Wester
Hi, thanks for your replies so far. The reason to use exec is just laziness. I have quite a lot of classes representing material data and every class has a number of parameters. The parameter are Magnitude objects (they have a value and a unit and overloaded special functions to correctly handle

SQLObject 1.2.2

2012-03-01 Thread Oleg Broytman
Hello! I'm pleased to announce version 1.2.2, a bugfix release of branch 1.2 of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use

Re: exec

2012-03-01 Thread Michael Ströder
Rolf Wester wrote: The reason to use exec is just laziness. The worst reason for using it. So I hope you carefully read Steven's comment and get rid of exec() for anything serious: <4f4f85eb$0$29989$c3e8da3$54964...@news.astraweb.com> Ciao, Michael. -- http://mail.python.org/mailman/listinf

RE: Help needed: dynamically pull data from different levels of a dict

2012-03-01 Thread Peter Rubenstein
Thanks, Chris. That's the algorithm I was looking for. And I will be converting most of this data to objects. Thanks again. -Original Message- From: Chris Rebert [mailto:c...@rebertia.com] Sent: Wednesday, February 29, 2012 11:44 PM Subject: Re: Help needed: dynamically pull data from

Re: exec

2012-03-01 Thread Peter Otten
Rolf Wester wrote: > The reason to use exec is just laziness. I have quite a lot of classes > representing material data and every class has a number of parameters. > The parameter are Magnitude objects (they have a value and a unit and > overloaded special functions to correctly handle the units)

Re: exec

2012-03-01 Thread Rolf Wester
Thank you, that really made things much easier and admittedly much less nasty too. Regards Rolf On 01/03/12 18:14, Peter Otten wrote: > Rolf Wester wrote: > >> The reason to use exec is just laziness. I have quite a lot of classes >> representing material data and every class has a number of pa

HELP ! Popen.terminate() - WindowsError: [Error 5] Access is denied

2012-03-01 Thread Nikunj Badjatya
Howdy All, Py ver - 3.2, Windows-XP . Logged in as user with admin privileges. >From my main python program, I am running powershell program using subprocess.Popen(). Now I have created a signal_handler() function in main python script which will handle CTRL-C ( This works fine ). Now when I

RE: HELP ! Popen.terminate() - WindowsError: [Error 5] Access is denied

2012-03-01 Thread Prasad, Ramit
> Now when I put "proc.terminate()" in my signal_handler() function to > terminate the subprocess created as well, > It is giving me "WindowsError: [Error 5] Access is denied" error. > I have tried with os.kill() also, same error. Tried with Popen.kill() also > same error. Have googled a bit but c

Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

2012-03-01 Thread Seymour J.
In , on 03/01/2012 at 05:07 AM, Chiron said: >Hmm... maybe, instead of just ridiculing him, I'm treating him as he treats others. >BTW, I happen to agree with you insofar as this poster not >understanding the nature of mathematics. His comment reminds me of >the article, "Transgressing th

Re: New Science Discovery: Perl Detracters Remain Idiots After A Decade!

2012-03-01 Thread Seymour J.
In , on 03/01/2012 at 04:52 AM, Chiron said: >Yes. That (the mathematically defined way) is a particular way, is >it not? No. There is no "the mathematically defined way". >However, I wasn't specifically referring to infix/postfix/prefix or >anything of that nature. I wasn't limiting my c

Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots Af

2012-03-01 Thread Devin Jeanpierre
On Thu, Mar 1, 2012 at 12:07 AM, Chiron wrote: > On Wed, 29 Feb 2012 23:10:48 -0500, Shmuel (Seymour J.) Metz wrote: > >> ROTF,LMAO! You obviously don't have a clue as to what Mathematics means. >> Free hint: it doesn't mean Arithmetic. You're as bigoted as Xah Lee, > > > Hmm... maybe, instead of

Re: lang comparison: in-place algorithm for reversing a list in Perl,Python, Lisp

2012-03-01 Thread Xah Lee
On Mar 1, 7:04 am, Kaz Kylheku wrote: lisp: (floor (/ x y)) --[rewrite]--> (floor x y) Thanks for this interesting point. I don't think it's a good lang design, more of a lang quirk. similarly, in Python 2.x, x/y will work when both x and y are integers. Also, x//y works too, but that // is j

Re: lang comparison: in-place algorithm for reversing a list in Perl, Python, Lisp

2012-03-01 Thread Rainer Weikusat
Xah Lee writes: [...] > similarly, in perl, either one > require POSIX; floor(x/y); > the require POSIX instead of Math is a quirk. But even, floor should > really be builtin. > or > using a perl hack > int(x/y) > > all of the above are quirks. They rely on computer engineering by- > products (s

Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!

2012-03-01 Thread Westley Martínez
First of all: http://www.youtube.com/watch?v=z5jKMEB4hHE On Wed, Feb 29, 2012 at 12:09:16AM -0800, Xah Lee wrote: > Now, let me tell you what operator precedence is. First of all, let's > limit ourselfs to discuss operators that are so-called binary > operators, which, in our context, basically m

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread Rick Johnson
On Feb 29, 10:41 pm, John Salerno wrote: > I'm not sure I understand which method you are advocating. It > sounded like you said calling Tk() explicitly is a bug. I am saying just the opposite: Allowing the module "Tkinter" to implicitly create a root window IF the programmer was too lazy to cre

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread Rick Johnson
On Feb 29, 11:24 pm, Terry Reedy wrote: > On 2/29/2012 10:22 PM, Rick Johnson wrote: > > PS: I would highly suggest against using the "from Tkinter import *". > > Instead, use "import Tkinter as tk" and prefix all module contents > > with "tk.". > > I have changed the example to do that. I also s

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread Rick Johnson
On Mar 1, 12:14 am, John Salerno wrote: > > What exactly is the purpose of doing that? Does Tk do some extra work that > > a simple call to Frame won't do? > > More specifically, what is the benefit of doing: > > root = tk.Tk() > app = Application(master=root) > app.mainloop() > > as opposed to:

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread Rick Johnson
On Feb 29, 11:40 pm, John Salerno wrote: > The faulty code is not my own, which is part of the reason I asked > the question. The book I'm reading (The Quick Python Book) does not > use it, but I saw in the Python docs that it is there, under > "tkinter" in the Global Module Docs, "24.1.2.2. A Sim

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread John Salerno
> EXAMPLE 1: (this works, but is flawed!) > root = tk.Tk() > b = tk.Button(master=None, text='Sloppy Coder') > b.pack() > root.mainloop() > > EXAMPLE 2: (This is how to write code!) > root = tk.Tk() > widgetframe = tk.Frame(root) > b = tk.Button(master=None, text='Sloppy Coder') > b.pack()

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread Rick Johnson
On Mar 1, 9:15 pm, John Salerno wrote: > > EXAMPLE 1: (this works, but is flawed!) > >  root = tk.Tk() > >  b = tk.Button(master=None, text='Sloppy Coder') > >  b.pack() > >  root.mainloop() > > > EXAMPLE 2: (This is how to write code!) > >  root = tk.Tk() > >  widgetframe = tk.Frame(root) > >  b

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread Rick Johnson
On Mar 1, 8:49 pm, Rick Johnson wrote: > On Feb 29, 11:24 pm, Terry Reedy wrote: > > > On 2/29/2012 10:22 PM, Rick Johnson wrote: > > > PS: I would highly suggest against using the "from Tkinter import *". > > > Instead, use "import Tkinter as tk" and prefix all module contents > > > with "tk.".

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread Terry Reedy
On 3/1/2012 9:49 PM, Rick Johnson wrote: On Feb 29, 11:24 pm, Terry Reedy wrote: There is a minor problem left. The hi_there Button text has underscores because if I use spaces instead, tk surrounds the text with {bra ces}. This seems bizarre. Is there any way to have Button text with spaces

Spacing and timing for comparing algorithms and data-structures

2012-03-01 Thread Alec Taylor
What would you recommend I use to compare data-structures and algorithms on space and time? (runtime) Thanks for all suggestions, Alec Taylor -- http://mail.python.org/mailman/listinfo/python-list

this afternoon's duck typing exercise ...

2012-03-01 Thread Cameron Simpson
Sorry, little technical content here, just a newly hatched programmer: duck typing, an intro http://www.flickr.com/photos/cskk/6799351990/in/photostream/ duck typing, resting after the demo http://www.flickr.com/photos/cskk/6945461405/in/photostream/ Cheers, -- Cameron Simpson DoD#743

Re: Is it necessary to call Tk() when writing a GUI app with Tkinter?

2012-03-01 Thread John Salerno
> Hmm, it seems as though i am the latest victim of the "copy/paste > error"! Oh well, if you were going to absorb my teachings, you would > have absorbed them by now. I am moving on unless a new subject needs > explaining. Well, I've certainly absorbed your recommendation to always create the roo

Re: this afternoon's duck typing exercise ...

2012-03-01 Thread Steven D'Aprano
On Fri, 02 Mar 2012 16:15:47 +1100, Cameron Simpson wrote: > Sorry, little technical content here, just a newly hatched programmer: > > duck typing, an intro > http://www.flickr.com/photos/cskk/6799351990/in/photostream/ I love it! Excellent! -- Steven -- http://mail.python.org/mailman/

Re: Spacing and timing for comparing algorithms and data-structures

2012-03-01 Thread Chris Rebert
On Thu, Mar 1, 2012 at 8:55 PM, Alec Taylor wrote: > What would you recommend I use to compare data-structures and > algorithms on space and time? (runtime) For the latter metric, one of the profiling modules: http://docs.python.org/library/debug.html I'd start with timeit and go from there: http

Re: GUIs - a modest proposal

2012-03-01 Thread lkcl
folks hi, apologies for picking this up so late - it's only when i find these things through random searches that i encounter the occasional post. At some point wa in the distant past, g4b wrote: > On the subject of the gui discussion mentioned here last year, > which you get lead to if you r

Is this the proper way to use a class method?

2012-03-01 Thread John Salerno
This is purely for fun and learning, so I know there are probably better ways of creating a chess program. Right now I'm just curious about my specific question, but I'd love to hear any other advice as well. Basically, I'm wondering if I'm using the class method properly with the move method.

Re: Is this the proper way to use a class method?

2012-03-01 Thread Chris Rebert
On Thu, Mar 1, 2012 at 10:00 PM, John Salerno wrote: > This is purely for fun and learning, so I know there are probably better ways > of creating a chess program. Right now I'm just curious about my specific > question, but I'd love to hear any other advice as well. > > Basically, I'm wondering

Re: this afternoon's duck typing exercise ...

2012-03-01 Thread Chris Angelico
On Fri, Mar 2, 2012 at 4:15 PM, Cameron Simpson wrote: > Sorry, little technical content here, just a newly hatched programmer: > >  duck typing, an intro >  http://www.flickr.com/photos/cskk/6799351990/in/photostream/ > >  duck typing, resting after the demo >  http://www.flickr.com/photos/cskk/6

Re: lang comparison: in-place algorithm for reversing a list in Perl,Python, Lisp

2012-03-01 Thread Chris Angelico
On Fri, Mar 2, 2012 at 9:04 AM, Xah Lee wrote: > One easy > way to measure it is whether a programer can read and understand a > program without having to delve into its idiosyncrasies. Neither the behavior of ints nor the behavior of IEEE floating point is a "quirk" or an "idiosyncracy". These a

Re: Is this the proper way to use a class method?

2012-03-01 Thread John Salerno
> That's just a coincidence. Your supercall is ought to be: super().move() > In contrast, super().move(self) calls the superclass instance method > `move` with 2 arguments, both `self`, which just happens to work given > your move() method, inside which `cls` isn't actually a class like it > ought

Re: lang comparison: in-place algorithm for reversing a list in Perl, Python, Lisp

2012-03-01 Thread WJ
Xah Lee wrote: > fun example. > > in-place algorithm for reversing a list in Perl, Python, Lisp > http://xahlee.org/comp/in-place_algorithm.html > > plain text follows > > > What's “In-place Algorithm”? > > Xah Lee, 2012-02-29 > > This page tells you w

Re: exec

2012-03-01 Thread Peter Otten
Prasad, Ramit wrote: > Hi Peter, > > >>> class Magnitude(object): > > ... def __init__(self, value): > ... self.value = value > ... def __call__(self, uf=1): > ... if uf == 1: > ... return self > ... return self.value > ... > > >>>

Re: New Science Discovery: Perl Idiots Remain Idiots After A Decade!New Science Discovery: Perl Idiots Remain Idiots After A Decade!

2012-03-01 Thread Chiron
On Wed, 29 Feb 2012 00:09:16 -0800, Xah Lee wrote: Xah, you won't grow even an inch taller by cutting others down. -- I joined scientology at a garage sale!! -- http://mail.python.org/mailman/listinfo/python-list