Re: [Tutor] running more than one python program at the same time

2012-09-03 Thread Oscar Benjamin
On Mon, 03 Sep 2012 18:55:43 +0100, Alan Gauld wrote: On 03/09/12 16:01, Benjamin Fishbein wrote: > Hi. I started running the program in the terminal rather than IDLE. It > works, and I can run several programs at the same time. The problem is > that when the program is finished running, it

[Tutor] running more than one python program at the same time

2012-09-04 Thread Oscar Benjamin
t; On Sep 3, 2012, at 2:50 PM, Oscar Benjamin wrote: > > > On Mon, 03 Sep 2012 18:55:43 +0100, Alan Gauld < > alan.ga...@btinternet.com> wrote: > >> On 03/09/12 16:01, Benjamin Fishbein wrote: > >> > Hi. I started running the program in the terminal rather than &

Re: [Tutor] making a shortcut in windows

2012-09-04 Thread Oscar Benjamin
On 4 September 2012 02:57, Garry Willgoose wrote: > I want to put a shortcut onto the desktop in windows (XP and later) in > Python 2.6 or later. In Unix its easy using os.symlink but I can't find > anything equivalent for windows. My searches on the web led me to the code > below but the code re

Re: [Tutor] how to print array without adding newline

2012-09-06 Thread Oscar Benjamin
On Sat, 18 Aug 2012 18:17:16 -0700 (PDT), vickistan wrote: Hello: I am trying to output an array to another program that takes an array as input, but the print statement adds a newline. If it were adding to each individual element, I could solve it easily, but it is adding one at the end of

Re: [Tutor] Making big 'uns into little 'uns

2012-09-06 Thread Oscar Benjamin
On 2012-09-06, Ray Jones wrote: > > Basically it's as simple as ensuring that an array consists of integers, > and that those integers fall within a certain range. Rather than using > multiple 'if' statements, I was (am, at this point) using multiple tests > within a single 'if' statement. Nothing

Re: [Tutor] Print List

2012-09-12 Thread Oscar Benjamin
On Sep 12, 2012 4:53 PM, "Ashley Fowler" wrote: > > I am trying to complete the following below: > > > You also need to write a function "printList" of one parameter that > takes a list as its input and neatly prints the entire contents of the > list in a column. Each student in the list should be

Re: [Tutor] index of elements in numpy array

2012-09-13 Thread Oscar Benjamin
On 13 September 2012 21:16, Bala subramanian wrote: > Friends, > I have a 2D matrix (a numpy array) and i am looping over each row in > the matrix. I would like to know how i can find the index of each > element in a while looping a row. Is there any function in numpy. > Your question could mean

Re: [Tutor] index of elements in numpy array

2012-09-14 Thread Oscar Benjamin
On 14 September 2012 11:05, eryksun wrote: > On Fri, Sep 14, 2012 at 4:36 AM, Bala subramanian > wrote: > > > > 10 # loop over each row > > 11 for i1, d1 in enumerate(b): > > 12 # each x in d1 - value in z corresponding to index of x in d1 > > 13 d1=[x-z[d1.index(x)] for x in d1] > >

Re: [Tutor] reducing a list evenly when deleting elements by index

2012-09-16 Thread Oscar Benjamin
On 17 September 2012 02:15, Pete O'Connell wrote: > Hi, I have a bezier line with 20 points on it and I am trying to reduce > this to a line with 4 points, keeping the first and last points and 2 > evenly spaced points in between like so: > ** > becomes: > *. . .

Re: [Tutor] reducing a list evenly when deleting elements by index

2012-09-17 Thread Oscar Benjamin
On 2012-09-17, Steven D'Aprano wrote: > On 17/09/12 11:15, Pete O'Connell wrote: >> Hi, I have a bezier line with 20 points on it and I am trying to reduce >> this to a line with 4 points, keeping the first and last points and 2 >> evenly spaced points in between like so: > > In general in Python,

Re: [Tutor] How to run this block of code dozens of times

2012-09-17 Thread Oscar Benjamin
On 2012-09-17, Emile van Sebille wrote: > > Be sure you don't at some point depend on _ having a specific value > however, as return values of functions are given the _ name in the > absense of a designated label for the returned value: > > ActivePython 2.6.6.15 (ActiveState Software Inc.) based

Re: [Tutor] combining c and python

2012-09-17 Thread Oscar Benjamin
On 2012-09-17, Bala subramanian wrote: > Friends, > I code in python and so far able to write simple scripts for my needs. > Now i want to try the combination of c and python. > > 1) could someone please suggest me some good documentation on how > python and C can be combined. Some tutorials with

Re: [Tutor] combining c and python

2012-09-17 Thread Oscar Benjamin
On 2012-09-17, Walter Prins wrote: > Hi Chris, > > On 17 September 2012 18:43, Chris Fuller > wrote: >> To run C alongside Python, you need to use the API. >> >> You can interface Cython with straight C, of course, but not in a way that >> will work with the standard interpreter. > > Just to be c

Re: [Tutor] Input handling?

2012-09-18 Thread Oscar Benjamin
On Sep 18, 2012 7:14 AM, "Steven D'Aprano" wrote: > > On Tue, Sep 18, 2012 at 12:04:22AM -0400, Dave Angel wrote: > > Somehow you managed to put your other message in its own thread, instead > > of adding to this one. > > Not all mail clients support threading, either when receiving or > sending.

Re: [Tutor] Input handling?

2012-09-18 Thread Oscar Benjamin
On Sep 18, 2012 10:02 AM, "Oscar Benjamin" wrote: > > > On Sep 18, 2012 7:14 AM, "Steven D'Aprano" wrote: > > Apologies for gmail screwing up your name. I wish I could use mutt on this machine. Oscar __

Re: [Tutor] Storing information as attributes or in a dictionary

2012-09-18 Thread Oscar Benjamin
On 18 September 2012 15:14, Michiel de Hoon wrote: > Dear all, > > Suppose I have a parser that parses information stored in e.g. an XML > file. I would like to design a Python class to store the information > contained in this XML file. > > One option is to create a class like this: > > class Re

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-19 Thread Oscar Benjamin
On 19 September 2012 19:00, Gregory Lund wrote: > >>> and then run it from the shell like this: > On Wed, Sep 19, 2012 at 10:20 AM, Peter Otten <__pete...@web.de> wrote: > > Gregory Lund wrote: > > >>> and then run it from the shell like this: > ahh, windows shell, not python shell. > > from the

Re: [Tutor] Populating a list with object to be called by a class

2012-09-20 Thread Oscar Benjamin
On 20 September 2012 15:41, Ara Kooser wrote: > Morning, > > I dug out some old code from 5 years ago to clean up and get in working > order. It's a simple agent based model. I have class called Ant which > contains all the ant-like functions. > > I have a list that tracks the ants but I did th

Re: [Tutor] np array.any() question

2012-09-21 Thread Oscar Benjamin
On Sep 21, 2012 4:09 PM, "Bala subramanian" wrote: > > Friends, > May i know why do get a Valuerror if i check any value in a is between > 3.0 to 5.0 ? > >>> import numpy as np > >>> a=np.array([ 2.5, 2.6, 3.0 , 3.5, 4.0 , 5.0 ]) > >>> (a > 7).any() > False > >>> (a > 4).any() > True > >>> (3

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-23 Thread Oscar Benjamin
On Sep 21, 2012 8:10 PM, "Gregory Lund" wrote: > print zipContents > > z.close You need to have round brackets to actually call the close method, i.e.: z.close() > > > It works, I get the following in the Python Shell: > > '>>> ==

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-23 Thread Oscar Benjamin
On 24 September 2012 02:22, Gregory Lund wrote: > > You're trying to open the directory as if it were a zipfile. You should > > pass in the path to a zipfile not to a folder. > > Agreed, but how do I do that "pass in the path to a zipfile'? > Using an if statement I presume? > > > > > > > I gues

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-23 Thread Oscar Benjamin
On 24 September 2012 02:34, Oscar Benjamin wrote: > On 24 September 2012 02:22, Gregory Lund wrote: > > >> > You're trying to open the directory as if it were a zipfile. You should >> > pass in the path to a zipfile not to a folder. >> >> Agreed,

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-23 Thread Oscar Benjamin
On 24 September 2012 03:00, Gregory Lund wrote: > >>> > You're trying to open the directory as if it were a zipfile. You > should > >>> > pass in the path to a zipfile not to a folder. > >>> > >>> Agreed, but how do I do that "pass in the path to a zipfile'? > >>> Using an if statement I presume?

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-23 Thread Oscar Benjamin
On 24 September 2012 03:26, Gregory Lund wrote: > > > > but a better way to do that is: > > if item.endswith('.zip') > > > >> x = zipfile.Zipfile(item,'r') > >> x.extractall() > >> x.close() > >> > ok, I used that (above) > typed below: > > for item in zipContents: > i

Re: [Tutor] running program in terminal

2012-09-24 Thread Oscar Benjamin
On 24 September 2012 17:41, Benjamin Fishbein wrote: > Hello. I can run programs in IDLE but when I try to do it in a terminal or > with textwrangler, it usually just logs out and says it's completed, but > the program hasn't been run. This is particularly so when the program uses > urllib. I'm u

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-24 Thread Oscar Benjamin
On 24 September 2012 22:15, Gregory Lund wrote: > >> but now get a " x = zipfile.Zipfile(item,'r') > >> AttributeError: 'module' object has no attribute 'Zipfile' " > >> > >> error > >> > >> gr, this is going to send me to the funny farm! > >> > >> greg > >> > > One way to avoid the "funny

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-24 Thread Oscar Benjamin
On 25 September 2012 00:33, Gregory Lund wrote: > > z.extractall(outDir) > > zipContents = z.namelist() > print zipContents > z.close() > > for item in zipContents: > if item.endswith('.zip'): > x = zipfile.ZipFile(item,'r') > x.extractall() > x.close() > > Traceback (m

Re: [Tutor] python new window

2012-09-28 Thread Oscar Benjamin
Hi Zack, On 11 September 2012 22:18, zack dunphey wrote: > I have used python a lot at school and am relatively good with it. I just > tried to get it on my mac and i try to open a "new window" and every time I > do it freezes and i have to either do a forced quit or unplug the whole > compute

Re: [Tutor] floating point rounding inconsistency

2012-09-28 Thread Oscar Benjamin
On 19 September 2012 19:27, Andrew Tritt wrote: > Hello, > > I am new to python, and I was experimenting with the round function, and > came across what appears to be a bug in floating point rounding. I am > guessing there is a valid explanation for it. > > When I round the floating points 10.6[0

Re: [Tutor] assembly language and boot loader

2012-09-28 Thread Oscar Benjamin
On 23 September 2012 05:46, Fit Wii wrote: > Is there any IDE or Python interpreter that can show the assembly language > generated by each line of python code? Is there any popular boot loader > written in Python (plus some assembly code)? > Python doesn't generate assembly language code. It d

Re: [Tutor] list all links with certain extension in an html file python

2012-09-28 Thread Oscar Benjamin
On 16 September 2012 08:20, Santosh Kumar wrote: > I want to extract (no I don't want to download) all links that end in > a certain extension. > > Suppose there is a webpage, and in the head of that webpage there are > 4 different CSS files linked to external server. Let the head look > like thi

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-09-28 Thread Oscar Benjamin
On 28 September 2012 21:32, Jim Apto wrote: > Hello folks, > > I'm relatively new to python, and was asked to program a lotka-volterra > model (predator and prey relation) simulator. The program basically will > basically have a menu that takes user input, collect data, and then create > a graph

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-09-29 Thread Oscar Benjamin
On Sep 29, 2012 2:25 AM, "Alan Gauld" wrote: > > On 28/09/12 21:32, Jim Apto wrote: > >> I'm relatively new to python, and was asked to program a lotka-volterra >> model (predator and prey relation) simulator. > > > No idea what that means in practice but commenting purely on the code provided...

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-09-29 Thread Oscar Benjamin
On Sep 29, 2012 9:41 AM, "Oscar Benjamin" wrote: > > > On Sep 29, 2012 2:25 AM, "Alan Gauld" wrote: > > > > On 28/09/12 21:32, Jim Apto wrote: > > > >> I'm relatively new to python, and was asked to program a lotka-volterra > >

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-09-29 Thread Oscar Benjamin
On Sep 29, 2012 11:52 AM, "Steven D'Aprano" wrote: > > On 29/09/12 19:16, Alan Gauld wrote: >> >> As to using short names to keep things on a single line, there is a huge >> body of research in Comp Science that shows that meaningful names outweigh >> single line expressions every time in terms of

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-09-29 Thread Oscar Benjamin
On 28 September 2012 21:32, Jim Apto wrote: > Hello folks, > > I'm relatively new to python, and was asked to program a lotka-volterra > model (predator and prey relation) simulator. The program basically will > basically have a menu that takes user input, collect data, and then create > a graph

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-09-29 Thread Oscar Benjamin
On 29 September 2012 22:57, Alan Gauld wrote: > On 29/09/12 11:42, Steven D'Aprano wrote: > >> On 29/09/12 19:16, Alan Gauld wrote: >> > Totally agree. > My point is that we should not choose short names just to keep an > expression on a single line. The evidence suggests that the advantages of >

Re: [Tutor] generic repr method?

2012-09-29 Thread Oscar Benjamin
On 29 September 2012 21:15, Albert-Jan Roskam wrote: > Hi, > > I've written a __repr__ method that is supposed to *always* work. That is, > it returns an eval-able text representation of any class instance. > Will this really always work? No. > I'd find it useful is this is standard behavior

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-09-30 Thread Oscar Benjamin
On 30 September 2012 09:37, Alan Gauld wrote: > On 29/09/12 23:57, Oscar Benjamin wrote: > >> On 29 September 2012 22:57, Alan Gauld > > > My point is that we should not choose short names just to keep an >> expression on a single line >> >> &

Re: [Tutor] Tutor Digest, Vol 103, Issue 145

2012-09-30 Thread Oscar Benjamin
On 30 September 2012 12:47, Afzal Hossain wrote: > unsubscribe > > Apologies if we're boring you. You need to click the link at the bottom of the email to unsubscribe: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription

Re: [Tutor] Lotka-Volterra Model Simulation Questions

2012-10-01 Thread Oscar Benjamin
On Oct 1, 2012 12:26 AM, "Alan Gauld" wrote: > > On 30/09/12 11:50, Oscar Benjamin wrote: >> While I can write a script like the OP's in less than 5 minutes, in >> practise it takes longer to convince myself that the code is correct (if >> it is importan

Re: [Tutor] Help for Python Beginner with extracting and manipulating data from thousands of ASCII files

2012-10-01 Thread Oscar Benjamin
On Sep 30, 2012 11:10 PM, "Cecilia Chavana-Bryant" wrote: > > Hola again Python Tutor! Hi Cecilia > > With a friend's help I have the following code to extract reflectance data > from an ASCII data file, do a bit of data manipulation to calibrate the data > and then write the calibrated file i

Re: [Tutor] generic repr method?

2012-10-01 Thread Oscar Benjamin
On 1 October 2012 13:16, Albert-Jan Roskam wrote: > >> On Sat, Sep 29, 2012 at 4:15 PM, Albert-Jan Roskam >> wrote: >>> >>> def __repr__(self): >>> code = self.__class__.__name__ + "(" >>> for arg in inspect.getargspec(self.__init__).args [1:] : >>> if isinsta

Re: [Tutor] 1d to 2d array creation

2012-10-01 Thread Oscar Benjamin
On 1 October 2012 22:04, Bala subramanian wrote: > Friends, > I have an 1d array like a=[1, 1, 2, 2, 2, 3, 3, 1, 1, 1], i have to > convert it to 2d array for plotting as follows. The 2d array is filled > by a[colum index] to obtain the new array shown below. > > [ [ 1., 1., 0., 0., 0., 0.,

Re: [Tutor] Civil discourse from a newbie's perspective

2012-10-02 Thread Oscar Benjamin
On 2 October 2012 11:16, Cecilia Chavana-Bryant wrote: > > In my case, I am a complete beginner not only to python but programming in > general, a complete beginner to internet forums (this is my third post ever) > and I am also not a native English speaker. So, I feel triply ignorant when I >

Re: [Tutor] getattr works sometimes

2012-10-02 Thread Oscar Benjamin
On 2 October 2012 18:44, Tino Dai wrote: > Hi All, Hi Tino > > I'm using the get_class from: > > http://stackoverflow.com/questions/452969/does-python-have-an-equivalent-to-java-class-forname Can you show the relevant portion of your code please? > > and the get_class class works sometim

Re: [Tutor] getattr works sometimes

2012-10-02 Thread Oscar Benjamin
On 2 October 2012 19:27, Tino Dai wrote: > On Tue, Oct 2, 2012 at 2:20 PM, Tino Dai wrote: and the get_class class works sometime for finding modules within a certain directory. If the get_class doesn't work, it throws an AttributeError. >>> >>> I don't really understand what you m

Re: [Tutor] Help for Python Beginner with extracting and manipulating data from thousands of ASCII files

2012-10-02 Thread Oscar Benjamin
2 at 11:02 AM, Oscar Benjamin > wrote: >> >> On Sep 30, 2012 11:10 PM, "Cecilia Chavana-Bryant" >> wrote: >> > >> > fileDate = data[6][16:26] # location of the creation date on the data >> > files >> >> What format does fileDate h

Re: [Tutor] "ImportError: _strptime not supported"

2012-10-02 Thread Oscar Benjamin
On 2 October 2012 23:19, wrote: > The following code was recently suggested as an example of how the > datetime module could be used to solve a problem. Not having access to > Python at work, I found > http://pythontutor.com/visualize.html > thinking it would allow me to "play with Python" when

Re: [Tutor] [Tkinter-discuss] displaying an image

2012-10-04 Thread Oscar Benjamin
On 4 October 2012 20:31, Matthew Ngaha wrote: >> You need to install PIL to use the tutorial you are doing. >> >> http://www.pythonware.com/products/pil/ > > the site says > " > The current free version is PIL 1.1.7. This release supports Python > 1.5.2 and newer, including 2.5 and 2.6. A version

Re: [Tutor] Through a glass, darkly: the datetime module

2012-10-05 Thread Oscar Benjamin
On 5 October 2012 14:47, Richard D. Moores wrote: > I thought it would be useful to have a script that would tell me what > the date n days from today would be. The docs > () > seem to get me almost there. I can compute the number

Re: [Tutor] modulo

2012-10-07 Thread Oscar Benjamin
On 8 October 2012 00:07, Dave Angel wrote: > On 10/07/2012 06:49 PM, Esteban Izaguirre wrote: >> Hi, I'm following coursera's learn to program: the fundamentals, which >> teaches programming basics in python. Our first assignement involves the >> modulo operator with a negative divident, and while

Re: [Tutor] string rules for 'number'

2012-10-08 Thread Oscar Benjamin
On 8 October 2012 03:19, eryksun wrote: > As a supplement to what's already been stated about string > comparisons, here's a possible solution if you need a more 'natural' > sort order such as '1', '5', '10', '50', '100'. > > You can use a regular expression to split the string into a list of > (d

Re: [Tutor] managing memory large dictionaries in python

2012-10-16 Thread Oscar Benjamin
On 16 October 2012 21:03, Prasad, Ramit wrote: > Abhishek Pratap wrote: >> Sent: Tuesday, October 16, 2012 11:57 AM >> To: tutor@python.org >> Subject: [Tutor] managing memory large dictionaries in python >> >> Hi Guys >> >> For my problem I need to store 400-800 million 20 characters keys in a >>

Re: [Tutor] Which is better Practice and why

2012-10-22 Thread Oscar Benjamin
On 22 October 2012 12:54, Devin Jeanpierre wrote: > On Mon, Oct 22, 2012 at 7:45 AM, Matthew Ngaha wrote: Hi Devin, your context was missing the crucial part showing the "2nd one": >> they call the main program by simply calling the main function. I've also >> seen a more complcated: >> >> if _

Re: [Tutor] Which is better Practice and why

2012-10-22 Thread Oscar Benjamin
On 22 October 2012 16:14, eryksun wrote: > On Mon, Oct 22, 2012 at 9:35 AM, Oscar Benjamin > wrote: >> >> It is also sometimes useful to define a number of scripts that are in >> the same directory but share some code by importing one another. You >> need the if _

Re: [Tutor] Help - Using Sort and Join

2012-10-22 Thread Oscar Benjamin
On 22 October 2012 20:57, Daniel Gulko wrote: > Hi Python Tutor, Hi Daniel, > I have an issue trying to figure out how to print out final answers using > sort and join functions. Do you know how to use sort and join to print a list of strings in alphabetical order? > > Assignment Specification

Re: [Tutor] Iterators, example (need help)

2012-10-22 Thread Oscar Benjamin
On 23 October 2012 01:43, Steven D'Aprano wrote: > In general, your __iter__ method will be trivially simple: > > def __iter__(self): > return self > > and most of the logic will be in __next__. I see your __iter__ > method is a little more complicated, but I haven't studied it > in detail to

Re: [Tutor] Which is better Practice and why

2012-10-23 Thread Oscar Benjamin
On 23 October 2012 02:17, Devin Jeanpierre wrote: > On Mon, Oct 22, 2012 at 8:42 PM, Steven D'Aprano wrote: >> If you do that, and the module directly or indirectly imports itself >> while it is running as a script, you may run into trouble. But writing >> a dual-purpose module that is usable as

Re: [Tutor] Help on Remote File Copy & Exection

2012-10-25 Thread Oscar Benjamin
On 25 October 2012 10:26, Arumugam N wrote: > Hi All, > > First of the big thanks and congrats for managing such a brilliant online > community. I am new to Python and have started getting the taste of python > on my day to day work. > > I have a requirement and i am trying to solve it using pytho

Re: [Tutor] For - if - else loop; print selective output

2012-10-25 Thread Oscar Benjamin
On 25 October 2012 21:16, eryksun wrote: > On Thu, Oct 25, 2012 at 3:46 PM, Prasad, Ramit > wrote: >> >> Do you happen to know offhand if there is a difference between >> `in ` vs. `in ` vs. `in `? > > The "in" comparison (__contains__ method) is equivalent for list and > tuple. It has to search

Re: [Tutor] For - if - else loop; print selective output

2012-10-25 Thread Oscar Benjamin
On 26 October 2012 00:08, Steven D'Aprano wrote: > On 26/10/12 07:16, eryksun wrote: >> >> On Thu, Oct 25, 2012 at 3:46 PM, Prasad, Ramit >> wrote: >>> >>> >>> Do you happen to know offhand if there is a difference between >>> `in` vs. `in` vs. `in`? >> >> >> The "in" comparison (__contains__ me

Re: [Tutor] run with default value if input not given

2012-10-29 Thread Oscar Benjamin
On 29 October 2012 06:06, Saad Javed wrote: > Hi, > > #!/usr/bin/env python > > import sys > > x = 'Saad is a boy' > > def main(x): > a = [] > b = x.split(' ') > for item in b: > a.append(item) > print a > if __name__ == '__main__': > x = sys.argv[1] > main(x) > > > How can I make this program run

Re: [Tutor] run with default value if input not given

2012-10-29 Thread Oscar Benjamin
On 29 October 2012 13:32, Oscar Benjamin wrote: > > def main(x, y='default'): > print(x) > print(y) > > if __name__ == "__main__": > main(sys.argv[1:]) A quick correction. That should be (note the *): if __name__ == &q

Re: [Tutor] greater precision?

2012-10-29 Thread Oscar Benjamin
On 29 October 2012 10:19, Dave Angel wrote: > On 10/29/2012 05:49 AM, John Collins wrote: >> >> Sorry to bother, but if I can squeeze out *at least* 15 sig figs, (30 >> or more would be better!) I'd be a happy camper! >> XNumbers addon for Excel allows over 200 sig figs by switching to base >> 256

Re: [Tutor] running multiple concurrent processes

2012-10-30 Thread Oscar Benjamin
On 30 October 2012 19:18, richard kappler wrote: > As I sit through the aftermath of Sandy, I have resumed my personal quest to > learn python. One of the things I am struggling with is running multiple > processes. I read the docs on threading and am completely lost so am turning > to the most ex

Re: [Tutor] running multiple concurrent processes

2012-10-30 Thread Oscar Benjamin
On 30 October 2012 21:10, richard kappler wrote: > Oscar, thanks for the link, though I must say with all due respect, if it > was "obvious" I wouldn't have had to ask the question. Good link though. I > suspect the reason I didn't find it is I did my searches under threading as > opposed to multi

Re: [Tutor] running multiple concurrent processes

2012-11-03 Thread Oscar Benjamin
On 3 November 2012 20:20, richard kappler wrote: > To all, especially Dave, Oscar and Ramit, thanks for the discussion and > help. Tino, as soon as I have something to put up, I will gladly put it up > on Github. At the moment I only have a few snippets I've written in trying > to learn the variou

Re: [Tutor] running multiple concurrent processes

2012-11-03 Thread Oscar Benjamin
On 4 November 2012 01:03, richard kappler wrote: > Oscar, that was positively brilliant! Now I get it, I understand how to do > it, and I think this has rearranged my entire plan for the "MCP." If the MCP > is basically just a program that calls several other programs(processes) and > does that bi

Re: [Tutor] running multiple concurrent processes

2012-11-03 Thread Oscar Benjamin
On 4 November 2012 01:05, richard kappler wrote: > I notice no one has mentioned asyncore. Is that something I should stay away > from? I just started digging through the doc file. I've only briefly looked at asyncore. I've never heard anyone recommend it: the recommendations for asynchronous pro

Re: [Tutor] Fraction - differing interpretations for number and string - presentation

2015-04-17 Thread Oscar Benjamin
On 17 April 2015 at 03:29, Steven D'Aprano wrote: > On Thu, Apr 16, 2015 at 03:11:59PM -0700, Jim Mooney wrote: > >> So the longer numerator and denominator would, indeed, be more accurate if >> used in certain calculations rather than being normalized to a float - such >> as in a Fortran subrouti

Re: [Tutor] bin to dec conversion puzzlement

2015-04-20 Thread Oscar Benjamin
On 20 April 2015 at 08:44, Jim Mooney wrote: > I can't seem to get my head around this 'simple' book example of > binary-to-decimal conversion, which goes from left to right: > > B = '11011101' > I = 0 > while B: > I = I * 2 + int(B[0]) > B = B[1:] Follow through the loop and see what ha

Re: [Tutor] Python tkinter. Opening another script from main window stop main window from functioning. Looking for Help

2015-04-27 Thread Oscar Benjamin
On 26 April 2015 at 04:23, Spencer For Friends wrote: > Hi all. I'm new to Python and I'm trying my best to learn, but I'm really > struggling with some problems. > > I'm using a tkinter window with a button on it to open another Python > script. When the button is clicked and the new script loads

Re: [Tutor] Fwd: circular movement in pygame

2015-04-28 Thread Oscar Benjamin
On 28 April 2015 at 16:38, diliup gabadamudalige wrote: > > Looking at the code on this page lines 47 & 48 > > http://programarcadegames.com/python_examples/show_file.php?file=sprite_circle_movement.py > > is there a way to do > self.rect.x +*= some value* > self.rect.y += some value > > rather th

Re: [Tutor] Fwd: circular movement in pygame

2015-04-28 Thread Oscar Benjamin
On 28 April 2015 at 19:37, diliup gabadamudalige wrote: > > I thank all those who responded to my question > > Here is the code that I had written. > > When updating is applied to a surface object the rotation works but when it > is applied through a class to an object it goes wrong in about 3 rot

Re: [Tutor] Integrating TDD into my current project work-flows

2015-05-05 Thread Oscar Benjamin
On 4 May 2015 at 20:04, WolfRage wrote: > I would like some help integrating TDD into my current projects. > My chosen TDD framework is unittest from the standard library. > My system details are: Linux Mint 17.1 64-bit, Python 3.4, bzr(for version > control). > > My projects are structured like:

Re: [Tutor] reading lines from a list of files

2015-05-12 Thread Oscar Benjamin
On 12 May 2015 at 11:46, Peter Otten <__pete...@web.de> wrote: > > > although the reason > > for my inquiry was more to diminish levels of indentation > > than number of lines. > > You usually do that by factoring out the loops into a generator: > > def lines(files): > for file in files: >

Re: [Tutor] reading lines from a list of files

2015-05-13 Thread Oscar Benjamin
On 12 May 2015 at 19:08, Peter Otten <__pete...@web.de> wrote: >> >> A generator cannot guarantee that execution continues after a yield so >> any context manager used around a yield is dependent on __del__. I >> think a good rule of thumb is "don't yield from a with block". > > Uh-oh, I am afraid

[Tutor] Yielding from a with block

2015-05-27 Thread Oscar Benjamin
On 23 May 2015 at 10:52, Peter Otten <__pete...@web.de> wrote: > import csv > > I'm just wondering what other people think about this. Should code like make_lines below be discouraged? > def make_lines(): > with open('co2-sample.csv') as co2: > yield htbegin > for linelist in

Re: [Tutor] Yielding from a with block

2015-05-28 Thread Oscar Benjamin
On 28 May 2015 at 03:12, Steven D'Aprano wrote: > On Wed, May 27, 2015 at 11:27:46PM +0100, Oscar Benjamin wrote: > >> I'm just wondering what other people think about this. Should code >> like make_lines below be discouraged? >> >> > def make_lines():

Re: [Tutor] Yielding from a with block

2015-05-28 Thread Oscar Benjamin
On 28 May 2015 at 09:16, Peter Otten <__pete...@web.de> wrote: > ...but the obvious route is of course > >> It's usually fairly trivial to rearrange things so that this doesn't >> happen: >> >> def wrap_header_footer(fin): >> yield htbegin >> for linelist in csv.reader(fin): >> yiel

Re: [Tutor] Question About Image Processing in Python

2015-05-28 Thread Oscar Benjamin
On 28 May 2015 at 11:34, Serge Christian Ibala wrote: > Hello All, > > I want to know which version of Python is compatible (or can be associated > with which version of which "tools or package" for image processing) > > I am working under Window and it is so complicated to find out which version

Re: [Tutor] Yielding from a with block

2015-05-29 Thread Oscar Benjamin
On 29 May 2015 at 13:38, Steven D'Aprano wrote: > > Otherwise I stand by my earlier position that you are misinterpreting > what it means to exit a with block. Pausing it to yield is not an exit. > > I did an experiment, where I tried to break the finalisation > guarantee using break, return and r

Re: [Tutor] Yielding from a with block

2015-05-29 Thread Oscar Benjamin
On 29 May 2015 at 14:29, Steven D'Aprano wrote: > On Thu, May 28, 2015 at 10:16:00AM +0200, Peter Otten wrote: > >> Even if you limit yourself to CPython there is another effect: the order of >> execution may not meet one's expectations/requirements: > > [snip example] > > That's an interesting ex

Re: [Tutor] Problem in packages

2015-07-01 Thread Oscar Benjamin
On 1 July 2015 at 07:11, megha garg wrote: > Python version 2.7.10. > I have problem in installing .whl format packages. > what version of setuptools is required for .whl format packages. > I have installed Setuptools version 0.6.0 and upgraded pip to 7.0.3. > wndows 7 powershell 1. > I tried inst

Re: [Tutor] Are the methods in a class copied or just linked to?

2015-07-03 Thread Oscar Benjamin
On 3 July 2015 at 02:17, Steven D'Aprano wrote: > On Thu, Jul 02, 2015 at 12:30:23PM -0700, Jim Mooney Py3.4.3winXP wrote: > >> When an instance uses a class method, does it actually use the method that >> is in the class object's memory space, or is the method copied to the >> instance? > > The f

Re: [Tutor] Inheritance, superclass, ‘super’

2015-07-03 Thread Oscar Benjamin
On 3 July 2015 at 00:47, Ben Finney wrote: >> That depends on what you mean by break it., MI should allow the >> inheriting class to specify which, if any, of its direct superclasses >> methods are invoked. > > That “should” is contrary to Python's collaborative multiple inheritance > model. Inste

Re: [Tutor] Pytest help

2015-07-07 Thread Oscar Benjamin
On Tue, 7 Jul 2015 at 09:51 Sahil Chauhan wrote: > Hi, > > I am trying to use py.test for writing some selenium webdriver tests. I > wrote my first test and > pytest is deselecting that test even though I didn't mark any test. > > How can I resolve this issue? Is there some default setting used

Re: [Tutor] Shading Between Curves with Different Colour Over Specified X value Range

2015-07-28 Thread Oscar Benjamin
On Mon, 27 Jul 2015 at 20:53 Colin Ross wrote: > *Goal:* Shade between I_2 (curve 1) and I_3 (curve 2) with following > conditions: > - Green for 0 < x < 4 > - Red for 4 < x < 12 > > *Code: * > > *Note: Co

Re: [Tutor] OT: Test to see if ibisMail app is truly sending in plain text

2015-08-02 Thread Oscar Benjamin
On 1 Aug 2015 16:28, "boB Stepp" wrote: > > I apologize for the noise, but I felt it better to get this question answered definitively prior to posting questions from my iPad. > > I am on a brief vacation and only brought my iPad. I have been having a devil of a time searching the Internet for an

Re: [Tutor] find pickle and retrieve saved data

2015-08-05 Thread Oscar Benjamin
On 4 August 2015 at 23:09, Quiles, Stephanie wrote: > I am still struggling with this one. Hi Stephanie, Alan has already raised a few issues with your code so I'm just going to address the one that's showing in your error message. These two lines are generating the error message: > infile

Re: [Tutor] Creating lists with definite (n) items without repetitions

2015-09-07 Thread Oscar Benjamin
On 5 September 2015 at 23:28, Mark Lawrence wrote: > On 05/09/2015 10:09, Peter Otten wrote: >> >>> the 5 lists above do not match my task insofar as every of the 5 lists >>> contains 'a' and 'b' which should occur only once, hence my count of a >>> maximum of 301 lists, which might nor be correc

Re: [Tutor] Creating lists with definite (n) items without repetitions

2015-09-09 Thread Oscar Benjamin
On 9 September 2015 at 12:05, Francesco Loffredo via Tutor wrote: > Oscar Benjamin wrote: > > The problem is that there are 26 people and they are divided into > groups of 3 each day. We would like to know if it is possible to > arrange it so that each player plays ea

Re: [Tutor] Creating lists with definite (n) items without repetitions

2015-09-14 Thread Oscar Benjamin
On 10 September 2015 at 08:45, Francesco Loffredo via Tutor wrote: > > I wrote a small routine (below) to check when and if my code and the formula > do match. It easily shows that > they only match for len(pool) == (2 ** N) - 1, with N greater or equal to 2. That's interesting. I'm not sure exac

Re: [Tutor] Creating lists with definite (n) items without repetitions

2015-09-22 Thread Oscar Benjamin
On 21 September 2015 at 22:54, Francesco A. Loffredo wrote: >> > Still thinking about it. I have read about Steiner systems and the Social > Golfer problem, and I'm afraid this will remain an Unsolved Problem despite > my efforts. Up to now, I thought that backtracking can't be a solution, > unles

Re: [Tutor] stx, etx (\x02, \x03)

2015-09-22 Thread Oscar Benjamin
On 22 September 2015 at 15:44, richard kappler wrote: >> >>> >> Reread my original post and you'll see that your "s" isn't set the same >> way mine was > > > No. My implementation of your code: > > #!/usr/bin/env python > > with open('input/PS06Test_100Packages.xml', 'r') as f1: > with open('

Re: [Tutor] Creating lists with 3 (later4) items occuring only once

2015-09-28 Thread Oscar Benjamin
On 27 September 2015 at 12:39, marcus lütolf wrote: > Hello Martin. > I never exspected to get such motivating comments and advice !!! Thank you > again. > Referring to my statments below > > 1. I explain my task in plain text: > Flights (in golfers language) or Triples (in computer language) com

Re: [Tutor] Regarding installing a python package

2015-09-29 Thread Oscar Benjamin
On Tue, 29 Sep 2015 at 10:47 Chirag Shahani wrote: > Hi, > > Could any one please help me understand the following: > > Suppose I install a python package using python setup.py install provided > by the developer of a package. I need to track that changes in my file > system.. meaning what new di

Re: [Tutor] How to calculate the cumulative normal distribution

2015-10-02 Thread Oscar Benjamin
On Wed, 30 Sep 2015 10:14 Laura Creighton wrote: In a message of Wed, 30 Sep 2015 09:12:20 +0300, Michel Guirguis writes: >Good afternoon, > >How to calculate the cumulative normal distribution function CND in order to use this figure to calculate the call option based on the Black and Scholes mo

Re: [Tutor] Mutable data type in python

2015-10-06 Thread Oscar Benjamin
On 4 October 2015 at 00:13, Alan Gauld wrote: > On 03/10/15 23:20, C Smith wrote: >> >> On Sat, Oct 3, 2015 at 11:55 AM, Alan Gauld >> wrote: >>> >>> On 03/10/15 19:10, C Smith wrote: > > Here is my modified version which I think works as you want: > > def findMinDepthPath(n): >>>

  1   2   3   4   >