[Tutor] Python 3 Statistics?

2010-02-23 Thread James Reynolds
Hi All, I am brand new to python and programing in general. I've been writing a program that will eventually run a monte carlo simulation of some mortality events and I've been making decent progress so far. I decided to use Python 3, as a long term decision, but getting access to modules seems t

Re: [Tutor] Strange list behaviour in classes

2010-02-23 Thread James Reynolds
This thread inspired me to start learning object oriented as well, but it seems I must be missing something fundamental. If I could get an explanation of why I am raising the following exception, I would greatly appreciate it. I'm getting: Traceback (most recent call last): File "C:\Python31\Li

Re: [Tutor] Strange list behaviour in classes

2010-02-24 Thread James Reynolds
def variance(self, *value_list): > if self.value == 0: > var = 0 > else: > average = self.mean(*self.value) > for n in range(len(self.value)): > square = (self.value[n] - average)**2 > self.square_list.append(square) > var = sum(self.square_list) / len(self.square_list) > r

Re: [Tutor] Strange list behaviour in classes

2010-02-24 Thread James Reynolds
(*a) var = stats.variance(*a) stdev = stats.stdev(*a) z = stats.zscore(5, *a) print(mean, median, var, stdev, z) print() On Wed, Feb 24, 2010 at 7:33 PM, Alan Gauld wrote: > > "James Reynolds" wrote > > I understand, but if self.value is any number other then 0, then the "for

[Tutor] OOD - Another class question

2010-02-28 Thread James Reynolds
I have another question related to OOD. What I have is a module with one parent class and two child classes. Some stuff is done to the object that is passed to the function in one of the child classes and this then calls a function from the global class passing local variables (from the child class

[Tutor] Efficiency and speed

2010-03-19 Thread James Reynolds
Hello all: I've still been working towards learning the language, albeit slowly and I've been working on a project that is somewhat intense on the numerical calculation end of things. Running 10,000 trials takes about 1.5 seconds and running 100,000 trials takes 11 seconds. Running a million tria

Re: [Tutor] Efficiency and speed

2010-03-19 Thread James Reynolds
ts behind programming in general and how to program in python at the same time. On Fri, Mar 19, 2010 at 1:56 PM, Stefan Behnel wrote: > James Reynolds, 19.03.2010 17:41: > > I've still been working towards learning the language, albeit slowly and >> I've been worki

Re: [Tutor] Efficiency and speed

2010-03-19 Thread James Reynolds
ample): nx2 = self.nx1 for q in sample: for a in nx2: while a > q: pass yield a break On Fri, Mar 19, 2010 at 3:15 PM, Alan Gauld wrote: > "James Reynolds" wrote > > > I've made a few oth

Re: [Tutor] Efficiency and speed

2010-03-21 Thread James Reynolds
On Sat, Mar 20, 2010 at 1:17 PM, Steven D'Aprano wrote: > On Sat, 20 Mar 2010 05:47:45 am James Reynolds wrote: > > > This is a monte-carlo simulation. > > > > The simulation measures the expiration of something and those > > somethings fall into bins that a

[Tutor] First extension

2010-03-26 Thread James Reynolds
Hello All, I'm trying to write my first extension module, and I am getting the following error in my command prompt and I was hoping you all could help me. I have taken the following steps already: 1. My path is set for mingw/bin as well as python31. 2. There is a file in my disutils fold

Re: [Tutor] Display in a text field using tkinter

2010-04-02 Thread James Reynolds
On Fri, Apr 2, 2010 at 2:25 AM, adedoyin adegoke wrote: > from Tkinter import * > import MySQLdb > > class Snoop(Frame): > def __init__(self, master): > Frame.__init__(self, master) > self.grid() > self.create_widgets() > > def create_widgets(self): > Label(

Re: [Tutor] PYTHON 3.1

2010-05-18 Thread James Reynolds
On Tue, May 18, 2010 at 8:40 AM, Dipo Elegbede wrote: > Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit > (Intel)] on win32 > Type "copyright", "credits" or "license()" for more information. > >>> print 'hello' > SyntaxError: invalid syntax (, line 1) > >>> print ('hello') > he

Re: [Tutor] if statement

2010-11-02 Thread James Reynolds
the syntax is: if True: do something that you want to do if the condition you are testing is True, in your case when confirmed is "y" elif True: optional: do something else when the above condition is false and this condition is True. else: do something else when the above condition

Re: [Tutor] Problems passing a parameter in a GUI

2011-01-18 Thread James Reynolds
You have other issues at play here, but to answer your question from below: You are calling the method "reveal" prior to creating the global object "secret_text" You can try moving: x= self.submit_bttn=Button(self, text="Submit", command=self.reveal(x)) below self.secret_text = "" You w

Re: [Tutor] Problems passing a parameter in a GUI

2011-01-18 Thread James Reynolds
the attribute holding this value to instantiate your Calmex instance and once getmess gets called it should do the right thing. This might not be what you are after though, at the end of the day. On Tue, Jan 18, 2011 at 5:02 PM, James Reynolds wrote: > You have other issues at play here, b

Re: [Tutor] making object iterable

2011-02-05 Thread James Reynolds
You should probably read this section in the python tutorial: http://docs.python.org/tutorial/classes.html#iterators If you have any questions after that, I would suggest posting back here but that should cover it. On Sat, Feb 5, 2011 at 2:46 PM, Alex Hall wrote: > Hi all, > I have a class whi

Re: [Tutor] function help

2011-02-07 Thread James Reynolds
I'm not sure of the answer to your question, because i'm not sure I understand it. Perhaps you could rephrase it? But, there is some other stuff I noticed though: def padWithGaps(seq): for letter in seq: letter="-" line=len(seq) dashline=line*letter return dashli

Re: [Tutor] urgent help required! invalid syntax

2011-02-18 Thread James Reynolds
There's a few things I've noticed: 1. I would recommend using an IDE of some sort. I copy and pasted this into eclipse, and it told me straight away that you had a parenthesis problem on this line: d1=(log(s/x)+((r+v**2/2)*t)/(v*sqrt(t)) 2. Your function "dividend" isn't returning a value. 3. Un

Re: [Tutor] Python object

2011-02-24 Thread James Reynolds
I don't understand what you are trying to do? I'm assuming def GetAllAtrib is a method within a class; perhaps you could copy more the code base? It seems to be locating the three elements you have in that method just fine, but I'm guessing you have another print statement somewhere that is causi

Re: [Tutor] Help!

2011-03-03 Thread James Reynolds
This isn't so much as a python problem as it is a simple math problem, and I feel you are being lazy, but in the offchance you're having problems with the '/' operator: cooloff = (numitems/143)*313 total = cooloff + seconds I think you are using python 2.6 (and I guess 2.7) or older based on you

Re: [Tutor] Need help with dates in Python

2011-03-09 Thread James Reynolds
On Wed, Mar 9, 2011 at 1:34 PM, nookasree ponamala wrote: > Hi, > I'm new to Python programming. I've changed the code to below, but still it > is not working, Could you pls. make the corrections in my code. > > import datetime > t = () > tot = [] > min = datetime.date(2008, 1, 1) > max = datetime

Re: [Tutor] Processing Financial Calculations using Python

2011-03-16 Thread James Reynolds
For all of these, I wrote my own class with methods to create the correct output. there is not built in python functionality that I know, although there may be a package. For IRR, the method expects a list and at least one negative value. I believe the way I did NPV was a dictionary, where the key

Re: [Tutor] Saving information for my program

2011-03-21 Thread James Reynolds
On Mon, Mar 21, 2011 at 11:11 AM, michael scott wrote: > I apologize now but I'm going to be spamming the tutor list as I have just > decided to create an extremely ambitious project for someone of my level. > Anyhow, I will start with my first question. > > How do I save user created information

Re: [Tutor] if value not in dictionary, do a?

2011-03-25 Thread James Reynolds
On Fri, Mar 25, 2011 at 7:52 AM, Robert Sjoblom wrote: > Hi again, list! A quick question about dictionary behaviour. I have a > dictionary of keys, and the user should be able to enter values into > said dictionary. My idea was this: > > def addData(key, value): >dictionary[key] += int(value)

Re: [Tutor] String formatting question.

2011-03-29 Thread James Reynolds
On Tue, Mar 29, 2011 at 4:21 PM, Corey Richardson wrote: > On 03/29/2011 03:41 PM, Prasad, Ramit wrote: > > Is there a difference (or preference) between using the following? > > "%s %d" % (var,num) > > VERSUS > > "{0} {1}".format(var,num) > > > > > > Ramit > > If you're using Python 3, use the s

Re: [Tutor] Data frame packages

2011-03-31 Thread James Reynolds
On Thu, Mar 31, 2011 at 11:10 AM, Blockheads Oi Oi wrote: > On 31/03/2011 09:38, Ben Hunter wrote: > >> Is anybody out there familiar with data frame modules for python that >> will allow me to read a CSV in a similar way that R does? pydataframe >> and DataFrame have both befuddled me. One requir

Re: [Tutor] counting a list of elements

2011-04-01 Thread James Reynolds
The nice thing about Python is you don't have to build things from scratch, and I imagine most people would discourage on account of it being a waste of time, other then education value. But the "best practice" in my humble opinion would be to use the built in len function. If what you are after i

Re: [Tutor] Running python on windows

2011-04-11 Thread James Reynolds
I use http://cx-freeze.sourceforge.net/ personally. I found py2exe to be a headache compared to cx. On Mon, Apr 11, 2011 at 9:01 AM, Mike Silverson wrote: > Hi, I need to know if there is any way to run a python file without Python > installed on the target computer. I am trying to send a progra

Re: [Tutor] Running python on windows

2011-04-11 Thread James Reynolds
At least in my case it was about simplicity. If it was a simple matter of using a base python program, that would be one thing, but the last program i distributed here at work used pygtk as it's GUI (which at the time required four different packages, I believe they have consolidated this down to o

Re: [Tutor] Retrieve data

2011-04-12 Thread James Reynolds
NYtimes has an API http://developer.nytimes.com/ No clue on how well it works or even if the weather is in the API. Looks like a lot of fluff, like comments and such. At any rate, maybe you can request they add weather to their API. On Tue, Apr 12, 2011 at 12:36 PM

Re: [Tutor] Python 3.2 - Running in Idle but not in command window

2011-04-13 Thread James Reynolds
I double clicked it from my desktop and it opens just fine (though I didn't attempt to run it, because I have 2.6 on my work machine and I'm sure that will cause it to fail). Have you added python to Path environment variables in windows? On Wed, Apr 13, 2011 at 11:14 AM, Gary Beynon wrote: > -

Re: [Tutor] Python 3.2 - Running in Idle but not in command window

2011-04-13 Thread James Reynolds
Oh, belay my last, I misread the question. My apologies. On Wed, Apr 13, 2011 at 1:04 PM, James Reynolds wrote: > I double clicked it from my desktop and it opens just fine (though I didn't > attempt to run it, because I have 2.6 on my work machine and I'm sure that > wi

Re: [Tutor] how to develop a python exe file in windows using python3.1

2011-04-14 Thread James Reynolds
We literally just answered this question a couple days ago, but if you need to make an executable in 3.1, CX freeze i believe should work. On Thu, Apr 14, 2011 at 9:42 AM, ema francis wrote: > I am using python3.1 in windows environment.How can I create a python > executable file? > I tried with

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread James Reynolds
Slow day at work, so I tried something a little different mostly as a learning exercise for myself, let me know what you all think. I thought it would be useful to have a writer that scales and that organizes the data. For example, you might have 20 tests one day, and 5 the next. I broke up the d

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread James Reynolds
line 634, in save > doc.save(filename, self.get_biff_data()) > File "C:\Python26\lib\site-packages\xlwt\Workbook.py", line 615, in > get_biff_data > self.__worksheets[self.__active_sheet].selected = True > IndexError: list index out of range > > Thanks &

Re: [Tutor] create an xls file using data from a txt file

2011-05-11 Thread James Reynolds
Yes, thank you. Actually, I never knew that about the windows separators, since I've just always used the '\' out of habit. On Wed, May 11, 2011 at 2:39 PM, Prasad, Ramit wrote: > > > >your "\" is a "/" > > > > >when writing out a string, such as 'C:\test.xls', the "/" is an escape in > python

Re: [Tutor] String Processing Query

2011-05-16 Thread James Reynolds
concatenate the entire thing together, including the "*". Once you have that as a single string, use string.split('*') and you will have your two strings. On Mon, May 16, 2011 at 9:51 AM, Spyros Charonis wrote: > I have a file with the following contents: > > >from header1 > abcdefghijkl > mnopq

Re: [Tutor] Error in executing 'Python Filename.py'.

2011-05-19 Thread James Reynolds
You're in the python interpreter. Hit control C to go back to cmd and then you can do "python hello.py" On Thu, May 19, 2011 at 4:14 PM, Neha P wrote: > C:\>python hello.py > 'python' is not recognized as an internal or external command, > operable program or batch file. > > C:\>cd python26 > >

Re: [Tutor] Making a script part of the terminal

2011-05-20 Thread James Reynolds
We just had a similar question yesterday. Just make sure Python is on your PATH. CD to the directory where your file is located and then you can just type "python myfile.py" where myfile is the name of your file. On Fri, May 20, 2011 at 1:43 PM, michael scott wrote: > Okay, my title might be und

[Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
Hello All: As an intellectual exercise, I wanted to try my hand at writing some extensions in C. I was wondering if you all could look over my code and give some feedback. Here is the link for the code: http://pastebin.com/jw3ihfsN I have zero experience coding in C (and not much more coding in

Re: [Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
Thank you Rachel and Alan for the feedback. Oddly enough, I had created an exception between the time I sent this and your response to catch occasions when the list is empty (I will need to test a few other things, like what if the list holds items other than strictly numbers?) I did utilize some

Re: [Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
at 1:52 PM, Patty wrote: > > - Original Message - From: "Stefan Behnel" > To: > Sent: Thursday, May 26, 2011 9:10 AM > Subject: Re: [Tutor] Python Extensions in C > > > > James Reynolds, 26.05.2011 17:22: >> >>> As an intellectual exercise, I want

Re: [Tutor] Python Extensions in C

2011-05-26 Thread James Reynolds
On Thu, May 26, 2011 at 3:07 PM, Stefan Behnel wrote: > Stefan Behnel, 26.05.2011 18:10: > > James Reynolds, 26.05.2011 17:22: >> >>> As an intellectual exercise, I wanted to try my hand at writing some >>> extensions in C. >>> >> >> This

Re: [Tutor] checking if a variable is an integer?

2011-05-31 Thread James Reynolds
If prime numbers were finite (an ability to find *all *prime numbers) that would cause havoc with the fundamental theorem of arithmetic ;) On Tue, May 31, 2011 at 5:40 PM, Rachel-Mikel ArceJaeger < arcejae...@gmail.com> wrote: > Isn't one of the unsolved millenium prize problems one that includes

Re: [Tutor] Python Extensions in C

2011-06-01 Thread James Reynolds
s: There are three parameters now, not one. The later two are optional. they are (list, avg, and sample) sample is True by default. So you can pass it an average already. Lastly, any other pointers would be greatly appreciated. James On Thu, May 26, 2011 at 7:50 PM, Alan Gauld wrote:

Re: [Tutor] Python Extensions in C

2011-06-02 Thread James Reynolds
find if they > > are all together. > > Other than that I can't see the error, but its late and thats > quite a lot of code for a Python programmer to wade through! :-) > > > Alan Gauld > Author of the Learn To Program website > > http://www.alan-g.me.uk/ > > > --

Re: [Tutor] Syntax for Simplest Way to Execute One Python Program Over 1000's of Datasets

2011-06-09 Thread James Reynolds
My advice would be to stay away from generic names, like: for item in items: do stuff with item For a couple of lines its ok, but when programs get large, your program will get confusing even to you as the author. Sometimes, it's best just to do "for all in listx: but I think that's rare. Us

Re: [Tutor] Syntax for Simplest Way to Execute One Python Program Over 1000's of Datasets

2011-06-10 Thread James Reynolds
> > 3) Open the .txt file in Excel, remove the few lines I don't need (ie > single quotes, etc) Regarding Excel, you can write your output directly to an Excel file from python using the Python-Excel module. Just install all three packages. I use them all the time. Here is something that I wrote

Re: [Tutor] Syntax for Simplest Way to Execute One Python Program Over 1000's of Datasets

2011-06-10 Thread James Reynolds
Honestly no idea. At work I use 2.6 / 2.7. At home it's 3.2 / 2.7. I've never actually tried doing this at home, so I don't know. They have a mail list though, I would post there to find out. 2011/6/10 Válas Péter > > > 2011. június 10. 15:51 James Reynolds írta,

Re: [Tutor] Medical Decision-Making Question

2011-06-13 Thread James Reynolds
I would start by getting a lot of the parameters you need in a database such as SQLite (comes with python). So for example, you would have a disease with known symptoms. You could structure your tables with diseases symptoms So, say the disease is a cold in the table you will have a row for cold

Re: [Tutor] Break stament issue

2011-06-14 Thread James Reynolds
On Tue, Jun 14, 2011 at 2:59 PM, Susana Iraiis Delgado Rodriguez < susana.delgad...@utzmg.edu.mx> wrote: > Hello members! > > I'm doing a script that needs to loop to get some information, in order to > do that I'm using modules from OGR and Mapnik. These to get data from > shapefiles, but some of

Re: [Tutor] Step Value

2011-06-15 Thread James Reynolds
Without looking at your code, What is it that you know that's wrong about it? Are you getting a return value which you know is incorrect, is the program throwing error and you aren't sure why? or do you just suspect it is wrong but you aren't sure? When posing a question, it's helpful to know the

Re: [Tutor] step value

2011-06-15 Thread James Reynolds
I am copying and pasting your code here from the previous email: def ask_number(question, low, high): > """Ask for a number within a range.""" > response = None > if response in range(low, high, 1): > return response > while response not in range(low, high): > respon

Re: [Tutor] File parsing

2011-06-16 Thread James Reynolds
use split on the list to split it up. search each element for something like: if '"' == element[:-1]: if that evaluation is True, I would remove the quote mark from the word on the right side, and place a new one on the left side using something like '"' + element. I would do the same thing for

Re: [Tutor] Reading opened files

2011-06-17 Thread James Reynolds
Your problem is right here: >>> whole=file.read >>> print whole Your re-assigning the method "read()", which is a method of the object "file" to the variable "whole" So, when you print "whole" you can see that it is printing the location of the method in memory. If you were to print file.read yo

Re: [Tutor] getting error while solving a series that estimates the value of pi

2011-07-18 Thread James Reynolds
On Mon, Jul 18, 2011 at 12:10 PM, surya k wrote: > Hi, > > The problem is to estimate the value of pi using the following series. > *1 / pi = (( 2 * sqrt(2) )/ 9801 ) * SIGMA of k[ (4k)! (1103 + 26390*k) > / (k!^ 4 ) * 396^(4k) ]* > *where k is [0, infinity)* > * Problem is located at : Think

Re: [Tutor] Web Programming

2011-07-20 Thread James Reynolds
If it doesn't interest you, skip it and move on. You can always come back and learn it later, which will be easier anyway, with a more robust background. On Wed, Jul 20, 2011 at 11:22 AM, Dharmit Shah wrote: > Hi all, > > I have been reading Head First > Python

[Tutor] Python editor for Ipad

2011-07-21 Thread James Reynolds
I might have to discuss some routines I've written in Python (and possibly C). It would be easier to whip out the Ipad and show them some of the things I've done, rather than a bulky laptop. I could of course PDF everything with highlighting off of eclipse, but ideally Ideally I would prefer a way

Re: [Tutor] Removing characters in a string using format()

2011-07-21 Thread James Reynolds
Since you're using python 3, you can just use a star to unpack the list like so: >>> print(*x) a b >>> print(*x, sep = ', ') a, b You can use sep to change the separator if you want the commas still. On Thu, Jul 21, 2011 at 1:53 PM, Ryan Porter wrote: > Hi there, > > In one part of a program

Re: [Tutor] Python editor for Ipad

2011-07-21 Thread James Reynolds
Thanks for the input. I received another email off list and I think i'm going to look into " Textastic". The Cloud9 seems interesting, but I'm not assured to have internet access all the time (even if I do live in NYC). Thanks for all the replies! On Thu, Jul 21, 2011 at 5:09 PM, ian douglas w

Re: [Tutor] Stack problem usind Python2.6

2011-07-21 Thread James Reynolds
On Thu, Jul 21, 2011 at 5:16 PM, David Merrick wrote: > ##from stack import Stack > > class Stack: > def __init__(self): > self.items =[] > > def isEmpty(self): > return self.items ==[] > > def push(self,item): > self.items.append(item) > > def pop(self,ite

Re: [Tutor] Stack problem usind Python2.6

2011-07-21 Thread James Reynolds
On Thu, Jul 21, 2011 at 5:16 PM, David Merrick wrote: > ##from stack import Stack > > class Stack: > def __init__(self): > self.items =[] > > def isEmpty(self): > return self.items ==[] > > def push(self,item): > self.items.append(item) > > def pop(self,ite

Re: [Tutor] Viability of Python

2011-07-21 Thread James Reynolds
Source files for the 3.2 branch are located here: http://hg.python.org/cpython/file/f0475f78d45c the modules and objects directory has a lot of c files. there some elsewhere. In modules theres some that start with XX. those are demonstration i believe. On Thu, Jul 21, 2011 at 6:46 PM, Prasad, Ra

Re: [Tutor] Question regarding xml.dom.minidom: How do you send an unsignedByte in an wsdl request

2011-07-22 Thread James Reynolds
On Fri, Jul 22, 2011 at 2:18 PM, Garry Bettle wrote: > Howdy all, > > Hope this message finds everyone well - roll on the weekend! > > I'm trying some calls to an wsdl API I've subscribed to. > > But I'm struggling to know what they want when sending an unsignedByte in a > request. > > I'm using x

Re: [Tutor] What's the difference between %s and %r?

2011-07-23 Thread James Reynolds
I just use string{0}.format(arg) format and that solves needing to memorize % whatevers. On Sat, Jul 23, 2011 at 11:08 AM, Martin A. Brown wrote: > > Hello everybody, > > : > Hello! I'm having troubles understanding what is the difference > between %s > : > and %r(format characters). I did goog

Re: [Tutor] Object Management

2011-07-27 Thread James Reynolds
On Wed, Jul 27, 2011 at 9:51 AM, Alexander wrote: > Hello everyone. I'm having trouble wrapping my mind around a project I'm > working on. My goal is to create a program that manages (allows its users to > manipulate, search by criteria and edit) objects. There is one type of > object, for exampl

Re: [Tutor] KeyError?

2011-07-28 Thread James Reynolds
On Thu, Jul 28, 2011 at 11:50 AM, Shwinn Ricci wrote: > I have an excel file that I am reading cell values from and putting them > into a dictionary. the dictionary looks like this: > > scafPositions = {position[j]: direction[j]} > > where position[j] is exclusively floating/numerical values and

Re: [Tutor] KeyError?

2011-07-28 Thread James Reynolds
On Thu, Jul 28, 2011 at 12:11 PM, Prasad, Ramit wrote: > *From:* tutor-bounces+ramit.prasad=jpmchase@python.org [mailto: > tutor-bounces+ramit.prasad=jpmchase@python.org] *On Behalf Of *Shwinn > Ricci > *Sent:* Thursday, July 28, 2011 10:51 AM > *To:* tutor@python.org > *Subject:* [Tutor]

[Tutor] Fwd: KeyError?

2011-07-28 Thread James Reynolds
-- Forwarded message -- From: Shwinn Ricci Date: Thu, Jul 28, 2011 at 1:13 PM Subject: Re: [Tutor] KeyError? To: James Reynolds On Thu, Jul 28, 2011 at 12:42 PM, James Reynolds wrote: > > > On Thu, Jul 28, 2011 at 12:11 PM, Prasad, Ramit > wrote: > >>

Re: [Tutor] converting string to float

2011-08-10 Thread James Reynolds
On Wed, Aug 10, 2011 at 3:16 PM, Shwinn Ricci wrote: > I am reading values from excel using xlrd and using a variable to store > them in (as part of a loop), as such: > > position = sheet.cell(j, i).value > > however, I want to convert position to a floating point number, as the > actual cell va

[Tutor] Zip - password protect

2011-08-23 Thread James Reynolds
Does anyone know if a way to password protect a zip file? I have no issues creating the zip file, but I would like to password protect as well. I'm aware of a commercial solution, but I would like something open source. ___ Tutor maillist - Tutor@python

Re: [Tutor] Zip - password protect

2011-08-23 Thread James Reynolds
I tried that already. that's only to set the default password to read the zip, not to set a pasword (wording is misleading I think) On Tue, Aug 23, 2011 at 1:42 PM, Emile van Sebille wrote: > On 8/23/2011 10:19 AM James Reynolds said... > > Does anyone know if a way to password

Re: [Tutor] Zip - password protect

2011-08-23 Thread James Reynolds
On Tue, Aug 23, 2011 at 2:57 PM, Alan Gauld wrote: > On 23/08/11 19:23, James Reynolds wrote: > >> I tried that already. >> >> that's only to set the default password to read the zip, not to set a >> pasword (wording is misleading I think) >> >> >

Re: [Tutor] Zip - password protect

2011-08-23 Thread James Reynolds
On Tue, Aug 23, 2011 at 3:49 PM, Emile van Sebille wrote: > On 8/23/2011 12:31 PM James Reynolds said... > > I'm trying the 7-zip solution, but I can't get past this >> error: WindowsError: [Error 2] The system cannot find the file specified >> >

Re: [Tutor] Zip - password protect

2011-08-23 Thread James Reynolds
On Tue, Aug 23, 2011 at 4:11 PM, James Reynolds wrote: > > > On Tue, Aug 23, 2011 at 3:49 PM, Emile van Sebille wrote: > >> On 8/23/2011 12:31 PM James Reynolds said... >> >> I'm trying the 7-zip solution, but I can't get past this >>> error: W

Re: [Tutor] help with 'organization'

2011-08-25 Thread James Reynolds
On Thu, Aug 25, 2011 at 1:51 PM, John wrote: > Hello, I am writing a module that will have two classes ('runners') I > am calling them, as they will ultimately use subprocess to run a > command line program, so they are basically option parsers, etc... > > As I wrote the second 'runner', I realiz

Re: [Tutor] Is there a test for hashability?

2011-09-01 Thread James Reynolds
On Thu, Sep 1, 2011 at 10:32 AM, Richard D. Moores wrote: > The glossary defines "hashable" as: > > hashable > An object is hashable if it has a hash value which never changes > during its lifetime (it needs a __hash__() method), and can be > compared to other objects (it needs an __eq__() method)

Re: [Tutor] Is there a test for hashability?

2011-09-01 Thread James Reynolds
On Thu, Sep 1, 2011 at 11:37 AM, Hugo Arts wrote: > On Thu, Sep 1, 2011 at 5:28 PM, Richard D. Moores > wrote: > > Thanks, James, from your ideas I've come up with this function as a > > general test for hashibility of any object: > > > > def is_hashable(object): > >try: > >if hash(o

Re: [Tutor] 'function' object has no attribute 'writer'

2011-09-05 Thread James Reynolds
On Mon, Sep 5, 2011 at 12:08 PM, Susana Iraiis Delgado Rodriguez < susana.delgad...@utzmg.edu.mx> wrote: > I want to write a csv file, but I need the final user to give me some > values to open and update the file. My code is: > from Tkinter import * #Llamo las librerias graficas de Tk > import tk

Re: [Tutor] need advice about a dictionary ({})

2011-09-08 Thread James Reynolds
On Thu, Sep 8, 2011 at 10:03 AM, Alan Gauld wrote: > On 08/09/11 11:58, Richard D. Moores wrote: > >> I've succeeded in writing a dictionary ({}) that I can use as a small >> personal phone book. The dictionary (very shortened and simplified) >> looks like this in the script; >> >> p = {} >> >> p[

Re: [Tutor] databases

2011-09-10 Thread James Reynolds
On Sat, Sep 10, 2011 at 3:39 PM, Andre' Walker-Loud wrote: > Hi All, > > I am completely new to databases as well as using python to access/create > databases. I started googling about it and found so much info, I wasn't > sure where to begin to answer my first question. So I thought I would que

Re: [Tutor] range question

2011-09-22 Thread James Reynolds
On Thu, Sep 22, 2011 at 10:27 AM, Joel Knoll wrote: > Given a range of integers (1,n), how might I go about printing them in the > following patterns: > > 1 2 3 4 ... n > 2 3 4 5 ... n 1 > 3 4 5 6 ... n 1 2 > > etc., e.g. for a "magic square". So that for the range (1,5) for example I > would ge

Re: [Tutor] range question

2011-09-22 Thread James Reynolds
On Thu, Sep 22, 2011 at 11:08 AM, Steven D'Aprano wrote: > Joel Knoll wrote: > >> Given a range of integers (1,n), how might I go about printing them in the >> following patterns: >> 1 2 3 4 ... n2 3 4 5 ... n 13 4 5 6 ... n 1 2 etc., e.g. for a "magic >> square". So that for the range (1,5) for e

Re: [Tutor] list of objects?

2011-11-15 Thread James Reynolds
On Tue, Nov 15, 2011 at 8:40 AM, Elwin Estle wrote: > I am attempting to write a text based spider solitaire game. I have a > pretty simple card class, and a deck class, which has a list of card > objects, which are shuffled, then individual elements are put into > self.dealt, which is a 'list o

Re: [Tutor] IndexError: list index out of range

2011-11-21 Thread James Reynolds
On Tue, Nov 22, 2011 at 12:28 AM, John wrote: > > Hi all, > > I have wriiten the following code: > [Segment] > > def survivor(names, step): >>>index = step - 1 >next = names >while len(next)> 1: >next.remove (next[index]) > > > > However when ever i run it i get this e

Re: [Tutor] How to shorten this code using classes?

2011-11-23 Thread James Reynolds
On Wed, Nov 23, 2011 at 10:35 AM, Mic wrote: > Hi. > I have written a simple GUI program. It works just like it is intended to > do, but there > is a problem, I feel like I could make it shorter. I thought of using > classes instead of > doing it the way I have done. > > Here is my code: > > from

Re: [Tutor] pass tuples to user defined function(beginner)

2011-11-28 Thread James Reynolds
On Mon, Nov 28, 2011 at 12:32 PM, Mayo Adams wrote: > I am trying to pass a set of tuple strings from a file to a function I > have defined. Each tuple is on a separate line, and looks something > like this: > ('note',2048) > The function has two parameters , and is defined thus: def > findinde

Re: [Tutor] print method name

2011-12-08 Thread James Reynolds
On Thu, Dec 8, 2011 at 9:49 AM, rail shafigulin wrote: > i created a class and in some instances when i use it call some of its > methods i need to print a method name. the online search did produce some > results but none of them seem to work for me. for example one of them said > just to use __n

Re: [Tutor] Need Explanation...

2011-12-12 Thread James Reynolds
Sent from my iPad On Dec 12, 2011, at 7:08 AM, "Homme, James" wrote: > Hi, > Alan said: > Because app() returns the result of append(). > But append() returns None, since it modifies the list in place. > > This is one of the few features of Python I dislike. It would not have been > difficul

Re: [Tutor] A few Python Mysteries

2011-12-19 Thread James Reynolds
On Mon, Dec 19, 2011 at 11:35 AM, Wayne Watson wrote: > Win 7, 64-bit > > I had Py 2.5 installed on my PC earlier this year, and it began failing > around June. I finally uninstalled it, and tried 2.6. Still had problems > that centered around getting to IDLE. Uninstalled 2.6, and went to 2.7. >

Re: [Tutor] A few Python Mysteries

2011-12-19 Thread James Reynolds
On Mon, Dec 19, 2011 at 2:21 PM, Wayne Watson wrote: > > > On 12/19/2011 8:50 AM, James Reynolds wrote: > > > > On Mon, Dec 19, 2011 at 11:35 AM, Wayne Watson < > sierra_mtnv...@sbcglobal.net> wrote: > >> Win 7, 64-bit >> >> I had Py 2.5 install

Re: [Tutor] A few Python Mysteries

2011-12-20 Thread James Reynolds
On Tue, Dec 20, 2011 at 9:32 PM, Wayne Watson wrote: > I changed Python25 to Python27, and rebooted. I got the same two dll msgs > again. > > > On 12/19/2011 7:33 PM, Wayne Watson wrote: > >> It became apparent during the other part of this thread that I had not >> uninstalled Python 2.7, as I th

Re: [Tutor] help with script

2011-12-27 Thread James Reynolds
On Tue, Dec 27, 2011 at 8:31 PM, wrote: > hello, my name is nick. i got python for software design by Allen B. > Downey as a gift for christmas. i am completely new to programming and i am > having trouble figuring out how to do an exercise concerning script.. > my problem > 5 > x=5 > x+1 > im ok

Re: [Tutor] Using Python for a client interactive map application

2012-01-05 Thread James Reynolds
On Thu, Jan 5, 2012 at 10:58 AM, Alexander wrote: > Dear friends, > I'm emailing regarding a general question about working with Python and a > web-browser based interactive map application. Over the summer I had asked > a similar question and heard some things about the Django framework, does >

Re: [Tutor] decimal precision in python

2012-02-06 Thread James Reynolds
On Mon, Feb 6, 2012 at 10:25 AM, Kapil Shukla wrote: > i tried writing a small code to calculate option price using the binomial > tree model. I compared my results with results of the same program in > excel. There seems to be a minor difference due to decimal precision as > excel is using 15 dec

Re: [Tutor] formatting sql Was: Some help Please

2012-02-15 Thread James Reynolds
On Wed, Feb 15, 2012 at 12:13 PM, bob gailer wrote: > Welcome to python help. We are a few volunteers who donate time to assist. > > To assist you better: > 1 - provide a meaningful subject line - such as "formatting sql" > 2 - tell us what OS and Python version you are using. > 3 - what is your

Re: [Tutor] formatting sql Was: Some help Please

2012-02-15 Thread James Reynolds
On Wed, Feb 15, 2012 at 1:30 PM, Alan Gauld wrote: > On 15/02/12 18:03, James Reynolds wrote: > > >In you table the acc_id is 'mn0001' >> >In your sql Acc_ID = 'MN0001' >> >Why the difference in case? >> >> Normal

Re: [Tutor] FW: null inputs

2012-03-15 Thread James Reynolds
On Thu, Mar 15, 2012 at 10:32 AM, ADRIAN KELLY wrote: > > > Adrian Kelly > 1 Bramble Close > Baylough > Athlone > County Westmeath > > 0879495663 > > > -- > From: kellyadr...@hotmail.com > To: tutor@python.org > Subject: null inputs > Date: Thu, 15 Mar 2012 14:19:16 +0

Re: [Tutor] Lists and While Loops

2012-03-28 Thread James Reynolds
On Wed, Mar 28, 2012 at 2:53 PM, Ricky Brown wrote: > So I have to write a program that reads a message from the user and prints > a new message that contains all the words from the original message but in > the same order without repeating any of them unless they show up more than > once in the

Re: [Tutor] summing lists

2012-04-10 Thread James Reynolds
On Tue, Apr 10, 2012 at 11:22 AM, Hs Hs wrote: > Hi: > > I have 4 lists: > > >>> a > [40] > >>> b > [2] > >>> c > [23] > >>> d > [12] > > > how is it possible to do add elements in list. I can do this using > tupples, but I do not know how to append elements to tuple, thats the > reason I am usin

  1   2   >