RE: List loops

2007-10-09 Thread Hamilton, William
> From: Tommy Grav > > Hi everyone, > >I have a list of objects where I have want to do two loops. > I want to loop over the list and inside this loop, work on all > the elements of the list after the one being handled in the outer > loop. I can of course do this with indexes: > > >>> alist

RE: tkinter question

2007-10-08 Thread Hamilton, William
> -Original Message- > From: Kevin Walzer > > See http://www.codebykevin.com/blosxom/business/phynchronicity-new.png: > this is an application I develop. The layout is all handled by "pack" > and paned windows. Where you you use "grid" in a layout like this? > I'd use a three row grid, w

RE: sorteddict [was a PEP proposal, but isn't anymore!]

2007-10-01 Thread Hamilton, William
> From: thebjorn > What's stabledict? I'm assuming that ordereddict is a mapping that > maintains insertion order(?) Yes, ordereddict is a dict that maintains insertion order. Stabledict is probably a dict that maintains _an_ order, so that repr() and the like return the same value when used on d

RE: sorteddict PEP proposal [started off as orderedict]

2007-09-25 Thread Hamilton, William
> From: Paul Hankin > > > Here's a first go. Sorting occurs when the keys are iterated over, > making it fast (almost as a dict) for construction, insertion, and > deletion, but slow if you're iterating a lot. You should look at some > use cases to decide if this approach is best, or if a sorted

RE: An ordered dictionary for the Python library?

2007-09-12 Thread Hamilton, William
> From: Michele Simionato > > On Sep 12, 3:54 pm, Mark Summerfield <[EMAIL PROTECTED]> > wrote: > > On 12 Sep, 13:46, Michele Simionato <[EMAIL PROTECTED]> > > > > Actually I meant by key order, so insertion order doesn't matter at > > all. If you need a dictionary-like data structure that respect

RE: Python code-writing for the blind. Was (Re: newbie: stani's pythoneditor if-else)

2007-09-11 Thread Hamilton, William
> From: madzientist > > Thanks, everybody, for the very very useful and kind responses. > > There is a second reason why I asked the question about automatic de- > indenting. I am teaching myself Python partly so I can then help my > technically astute, but blind friend learn programming. For the

RE: Excel process still running after program completion.

2007-09-11 Thread Hamilton, William
> From: Chris > > I have a python script that is driving Excel and using the win32com > module. However, upon program completion there's still an Excel.exe > process running in the background that I must terminate through Task > Manager. Reading up on other threads indicate that maybe I still have

RE: newbie: stani's python editor if-else

2007-09-11 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of > [EMAIL PROTECTED] > Sent: Tuesday, September 11, 2007 8:26 AM > To: python-list@python.org > Subject: Re: newbie: stani's python editor if-else > > On Sep 10, 11:24 pm, madzientist <[EMAIL PRO

RE: Checking if elements are empty

2007-09-11 Thread Hamilton, William
> From: Steve Holden > Neil Cerutti wrote: > > On 2007-09-10, Chris Mellon <[EMAIL PROTECTED]> wrote: > >> On 9/10/07, Neil Cerutti <[EMAIL PROTECTED]> wrote: > >>> Agreed; but I prefer 'if y[0] == ""', absent more context and > >>> better names. > >> Probably should use u"" if you're going to take

RE: Silent SaveAs when using the Excel win32com module

2007-09-10 Thread Hamilton, William
> From: Chris > > I'm trying to create an excel file which will act as a log, however I > want to overwrite the file if it exists. > > Looking at the SaveAs method I can't find anything that would allow > it. I don't want the prompt to appear to ask whether to replace the > file or not. I just wa

RE: application version checking against database

2007-09-07 Thread Hamilton, William
> From: imageguy > > We are trying to implement a system that checks the version of the > application against a version number stored in the database. We don't > want the app and the db don't become out of sync. > > We have tried setting a __version__ variable in the top most module, > however,

RE: list index()

2007-08-30 Thread Hamilton, William
> From: [EMAIL PROTECTED] > > > > How could it not be an exception, in the plain English sense of the > > word? Most certainly you're asking for the index because you want to do > > something with the index. If the item is not found, you have no index, > > so that's a special case that must be hand

RE: Something in the function tutorial confused me.

2007-08-06 Thread Hamilton, William
> From: Lee Fleming > On Aug 6, 12:30 pm, "Hamilton, William " <[EMAIL PROTECTED]> wrote: > > When you call f(23), the variable y within it gets created and points at > > None. When f(23) exits, the y that it created gets destroyed. (Well, > > goes ou

RE: Something in the function tutorial confused me.

2007-08-06 Thread Hamilton, William
> From: Lee Fleming > > On Aug 6, 6:25 am, Neil Cerutti <[EMAIL PROTECTED]> wrote: > Because when the function is called, the line > > > > if y is None: y = [] > > > is executed, binding a brand new empty list to y. This > "rebinding" happens every time the function is called, unless you

RE: Bug in Time module, or in my understanding?

2007-08-02 Thread Hamilton, William
> From: Joshua J. Kugler > > I am getting results like these with the time module: > > >>> import time > >>> int(time.mktime(time.strptime('2007-03-11 02:00:00', '%Y-%m-%d %H:%M > %S'))) > 1173610800 > >>> int(time.mktime(time.strptime('2007-03-11 03:00:00', '%Y-%m-%d %H:%M > %S'))) > 1173610800

RE: Making Gridded Widgets Expandable

2007-07-30 Thread Hamilton, William
> From: Jim > Hi, > I'm looking at page 548 of Programming Python (3rd Edition) by Mark > Lutz. > The following GUI script works with no problem, i.e., the rows and > columns expand: > = > # Gridded Widgets Expandable page 548 > > fro

RE: PEP 3107 and stronger typing (note: probably a newbie question)

2007-07-05 Thread Hamilton, William
> From: Paul Rubin > > greg <[EMAIL PROTECTED]> writes: > > > E.g. your program might pass its test and run properly for years > > > before some weird piece of input data causes some regexp to not quite > > > work. > > > > Then you get a bug report, you fix it, and you add a test > > for it so tha

RE: Collections of non-arbitrary objects ?

2007-06-26 Thread Hamilton, William
> From: walterbyrd > > > Yes, but those languages also have the notion of structures that do > not allow arbitrary collections. That is what I was wondering about > when I started the thread. It's fine that python has four different > ways of creating collections of arbitrary data types, but I th

Excel file interface for Python 2.3?

2007-06-12 Thread Hamilton, William
I'm in need of a module that will let me create Excel workbooks from within Python. Something like PyExcelerator, but it needs to work with Python 2.3. (A third-party limitation that I have no control over.) Can anyone point me to what I need? All my searches keep leading back to PyExcelerator.

RE: c[:]()

2007-05-30 Thread Hamilton, William
> From: Warren Stringer > Hmmm, this is for neither programmer nor computer; this is for a user. If > I > wanted to write code for the benefit for the computer, I'd still be > flipping > switches on a PDP-8. ;-) > > This is inconsistent: > > why does c[:][0]() work but c[:]() does not? > Why does

RE: 'int' object is not callable in an threaded app

2007-05-22 Thread Hamilton, William
> From: king kikapu > > Hi, > > i have a problem with the following piece of code that id just drive > me nuts (from the morning...) > I think is more Python specific than Qt, folks from Qt forum have > already give me directions of how to do it but that Python error > message is just impossible

RE: Installing Python in a path that contains a blank

2007-05-22 Thread Hamilton, William
> From: John Machin > On 21/05/2007 11:30 PM, Konrad Hinsen wrote: > > I am trying to install Python from sources in my home directory on a Mac > > cluster (running MacOS X 10.4.8). The path to my home directory contains > > a blank, and since the installation procedure insists on getting an > > ab

RE: Random selection

2007-05-21 Thread Hamilton, William
> From: Tartifola > Hi, > I have a list with probabilities as elements > > [p1,p2,p3] > > with of course p1+p2+p3=1. I'd like to draw a > random element from this list, based on the probabilities contained in > the list itself, and return its index. > > Any help on the best way to do that? > Tha

RE: tkinter button state = DISABLED

2007-05-21 Thread Hamilton, William
> From: Eric Brunel On Thu, 17 May 2007 09:30:57 +0200, Hendrik van Rooyen > <[EMAIL PROTECTED]> wrote: > > "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > >> En Wed, 16 May 2007 03:22:17 -0300, Hendrik van Rooyen > >>> I have never seen this working in Tkinter, unless the button was > >>> presse

RE: tkFileDialog.askopenfilename()

2007-05-16 Thread Hamilton, William
> From: [EMAIL PROTECTED] > > Hi, > When I call tkFileDialog.askopenfilename() , the dialog box opens with > the current directory as the default directory. Is it possible to open > the dialog box with a directory other than the current directory. Can > we pass in a user defined starting director

RE: Trying to choose between python and java

2007-05-15 Thread Hamilton, William
> From: Beliavsky On May 15, 1:30 am, Anthony Irwin <[EMAIL PROTECTED]> wrote: > > > > > #5 someone said that they used to use python but stopped because the > > language changed or made stuff depreciated (I can fully remember > > which) and old code stopped working. Is code written today likely

RE: keyword checker - keyword.kwlist

2007-05-10 Thread Hamilton, William
> From: [EMAIL PROTECTED] > F:\Ohjelmat\Python25\Lib\keyword.pyc That's your problem. Rename keyword.py to keywordcheck.py, and delete keyword.pyc in this directory, and it should work fine. --- -Bill Hamilton -- http://mail.python.org/mailman/listinfo/python-list

RE: keyword checker - keyword.kwlist

2007-05-10 Thread Hamilton, William
> From: [EMAIL PROTECTED] > > Hi > > I try to check whether a given input is keyword or not. However this > script won't identify keyword input as a keyword. How should I modify it > to make it work? > > #!usr/bin/env python > import keyword > > input = raw_input('Enter identifier to check >> '

RE: change of random state when pyc created??

2007-05-10 Thread Hamilton, William
> From: Alan Isaac > > I'm sure my first pass will be flawed, but here goes: > > http://docs.python.org/lib/typesmapping.html: > to footnote (3), add phrase "which may depend on the memory location of > the > keys" to get: > > Keys and values are listed in an arbitrary order, > which may

RE: Simulating simple electric circuits

2007-05-09 Thread Hamilton, William
> From: Bjoern Schliessmann > Sounds more familiar than the analog approach. Maybe I misunderstood > something ... but I can't transfer my problem to this way of > thinking yet. My biggest problem is the fact that relays aren't > really interested in voltage, but current. > > Also, I find it diffi

RE: Strange terminal behavior after quitting Tkinter application

2007-05-07 Thread Hamilton, William
> From: Chris > > I'll admit to being surprised at seeing a claim that a tkinter > > application, started within an interactive session, without a mainloop, > > even runs... I could see it maybe happening from Idle, since Idle is > > running a tkinter mainloop, so the application bindings m

RE: How to check if a string is empty in python?

2007-05-04 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] > > On May 4, 5:02 am, Jaswant <[EMAIL PROTECTED]> wrote: > > This is a simple way to do it i think > > > > s=hello > > > > >>> if(len(s)==0): > > > > ... print "Empty" > > ... else: > > ... print s > > ... > > hello > > But you are

RE: Strange terminal behavior after quitting Tkinter application

2007-05-04 Thread Hamilton, William
> -Original Message- > From: Chris > Subject: Re: Strange terminal behavior after quitting Tkinter application > Clicking 'Quit' or on the window's 'x' causes the application to quit > without messing up the terminal. With root.mainloop() commented out, > though, no combination of root.quit

RE: Dict Copy & Compare

2007-05-01 Thread Hamilton, William
> -Original Message- > From: Steven D'Aprano > Sent: Monday, April 30, 2007 10:14 PM > To: python-list@python.org > Subject: RE: Dict Copy & Compare > > On Mon, 30 Apr 2007 12:50:58 -0500, Hamilton, William wrote: > > >> On quick question, h

RE: re-importing modules

2007-05-01 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of John Nagle > Sent: Monday, April 30, 2007 7:32 PM > To: python-list@python.org > Subject: Re: re-importing modules > > [EMAIL PROTECTED] wrote: > > >>In addition to the warning that reload() do

RE: Dict Copy & Compare

2007-04-30 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Robert Rawlins - > Think Blue > Sent: Monday, April 30, 2007 6:09 AM > To: 'Tim Golden' > Cc: python-list@python.org > Subject: RE: Dict Copy & Compare > > On quick question, how can I order a d

RE: import structures

2007-04-30 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of spohle > Sent: Monday, April 30, 2007 10:25 AM > To: python-list@python.org > Subject: Re: import structures > > On Apr 30, 8:16 am, "Hamilton, William " <

RE: import structures

2007-04-30 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of spohle > Sent: Monday, April 30, 2007 10:03 AM > To: python-list@python.org > Subject: Re: import structures > > On Apr 30, 8:00 am, Paul McGuire <[EMAIL PROTECTED]> wrote: > > On Apr 30, 9:56 a

RE: Python keywords

2007-04-26 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of gtb > Sent: Thursday, April 26, 2007 1:50 PM > To: python-list@python.org > Subject: Re: Python keywords > > On Apr 26, 10:16 am, Larry Bates <[EMAIL PROTECTED]> wrote: > > http://docs.python.or

RE: Tutorial creates confusion about slices

2007-04-25 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Antoon Pardon > Sent: Tuesday, April 24, 2007 7:40 AM > To: python-list@python.org > Subject: Re: Tutorial creates confusion about slices > > On 2007-04-24, Michael Bentley <[EMAIL PROTECTED]> w

RE: Tutorial creates confusion about slices

2007-04-23 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Antoon Pardon > Sent: Monday, April 23, 2007 7:38 AM > To: python-list@python.org > Subject: Tutorial creates confusion about slices > > The following is part of the explanation on slices in the

RE: Iterate through a dictionary of lists one "line" at a time

2007-04-18 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of wswilson > Sent: Wednesday, April 18, 2007 1:39 PM > To: python-list@python.org > Subject: Iterate through a dictionary of lists one "line" at a time > > Here is my code: > > listing = {'id': [

RE: tuples, index method, Python's design

2007-04-11 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Chris Mellon > Sent: Wednesday, April 11, 2007 9:12 AM > To: python-list@python.org > Subject: Re: tuples, index method, Python's design > > > So, when you have a) a third party module that you c

RE: pop() clarification

2007-04-11 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Scott > > I understand all that. What I don't understand is why all the > documentation > I see says, "When removing a specific element from a list using pop() it > must be in this format: list

RE: passing class by reference does not work??

2007-04-11 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of wswilson > Sent: Wednesday, April 11, 2007 9:24 AM > To: python-list@python.org > Subject: passing class by reference does not work?? > > Here is my code: > > class A(): > val = 0 > > de

RE: tuples, index method, Python's design

2007-04-11 Thread Hamilton, William
> -Original Message- > From: [EMAIL PROTECTED] [mailto:python- > [EMAIL PROTECTED] On Behalf Of Steven D'Aprano > Sent: Wednesday, April 11, 2007 7:49 AM > To: python-list@python.org > Subject: Re: tuples, index method, Python's design > > (There is one other option: you care that 32 is so

Re: Objects, lists and assigning values

2007-04-05 Thread Hamilton, William
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Manuel Graune Sent: Thursday, April 05, 2007 12:14 PM To: python-list@python.org Subject: Objects, lists and assigning values Hello, while trying to learn how to program using objects in python (up to now s

Re: Looping issues

2007-04-05 Thread Hamilton, William
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, April 05, 2007 1:01 PM To: python-list@python.org Subject: Looping issues What I am trying to do is compare two files to each other. If the 2nd file contains the same line t

Project organization and import redux

2007-04-05 Thread Hamilton, William
I apologize for bringing up something that's a month dead. But, I've been reading through the recent archives and came across this discussion, and want to make sure I understand a particular about the interactive prompt. "Martin Unsal" wrote: > I'm perfectly well aware that I'm not going to be a