Re: [Tutor] multiprocessing: getting data back from the processes

2019-07-23 Thread Oscar Benjamin
On Tue, 23 Jul 2019 at 00:29, Mats Wichmann wrote: > > I've got a scenario where I need to pass data in both directions of a > multiprocessing program. > So... what else should I be trying to make this a little cleaner? I think if possible it is best to set these things up as an acyclic

Re: [Tutor] Reading .csv data vs. reading an array

2019-07-16 Thread Oscar Benjamin
On Tue, 16 Jul 2019 at 01:44, Alan Gauld via Tutor wrote: > > On 15/07/2019 21:28, Mats Wichmann wrote: > > > course Python can do that too, by working line-at-a-time, explicitly by > > calling readlines() or implicitly by looping over the file handle. The > > latter looks something like this; >

Re: [Tutor] Reading .csv data vs. reading an array

2019-07-12 Thread Oscar Benjamin
On Thu, 11 Jul 2019 at 18:52, Chip Wachob wrote: > > Hello, Hi Chip, ... > So, here's where it gets interesting. And, I'm presuming that someone out > there knows exactly what is going on and can help me get past this hurdle. I don't think anyone knows exactly what's going on... ... > My

Re: [Tutor] Multiprocessing with many input input parameters

2019-07-12 Thread Oscar Benjamin
Hi Sydney, On Wed, 10 Jul 2019 at 16:45, Shall, Sydney via Tutor wrote: > > I am a relative beginner. > > My program models cell reproduction. I have written a program that models > this and it works. > > Now I want to model a tissue with several types of cells. I did this by > simply

Re: [Tutor] Basic Question about Visualization for enduser

2019-06-26 Thread Oscar Benjamin
On Tue, 25 Jun 2019 at 17:08, Sinardy Xing wrote: > > My question is, how currently all of this great technology glue together > and as a final product for the enduser. Because I cant imagine that we > install Anaconda Jupyter Notebook at frontend for the enduser to use it, > and give end user

Re: [Tutor] Looking for some direction

2019-05-17 Thread Oscar Benjamin
On Fri, 17 May 2019 at 17:17, Alan Gauld via Tutor wrote: > > Sorry I've been busy, my mother passed away early this morning > and we've been with her the last few days. Really sorry to hear that Alan. I hope you're holding up okay. (Obviously don't feel the need to answer python-tutor

Re: [Tutor] Looking for some direction

2019-05-16 Thread Oscar Benjamin
On Thu, 16 May 2019 at 04:30, Alex Kleider wrote: > > On 2019-05-12 00:59, Alan Gauld via Tutor wrote: > > On 12/05/2019 00:24, David L Neil wrote: > > > > Alt-Tab and the X cut 'n paste mechanism provides > > enough integration between windows. > > I tried this (Ubuntu 18.4) and Alt-Tab cycles

Re: [Tutor] Putting a Bow on It

2019-02-18 Thread Oscar Benjamin
On Mon, 18 Feb 2019 at 13:41, Chip Wachob wrote: > > The code that I've written is entirely Python. There are necessary libraries > that go along with that, and, due to my inexperience, I am not 100% certain > they are pure Python or not. Some of the drivers from the IC manufacturer > (FTDI)

Re: [Tutor] Putting a Bow on It

2019-02-18 Thread Oscar Benjamin
On Mon, 11 Feb 2019 at 17:30, Alan Gauld via Tutor wrote: > > Three is a lot of work going on in Python land but no universal > solution. Some things work better on particular platforms. > And building library packages is easier than complete applications. I think this is the basic problem.

Re: [Tutor] Python installtion

2019-01-07 Thread Oscar Benjamin
On Mon, 7 Jan 2019 at 11:10, mousumi sahu wrote: > > Dear Sir, > I am trying to install python 2.7.10 on HPC. Python 2.6 has already been > install on root. I do not have root authority. Please suggest me how can I > do this. Does HPC stand for High-Performance Computing? Are you trying to set

Re: [Tutor] Moving a conda environment to an off-line computer

2018-12-01 Thread Oscar Benjamin
On Sat, 1 Dec 2018 at 00:10, Henrique Castro wrote: > > Dear colleagues, > Soon I'll start to use one of the powerful computers on my university as a > tool in my Ph.D. The computer does not have an internet connection and I need > to find a way to install a conda environment on it. When you

Re: [Tutor] best way to dynamically set class variables?

2018-11-07 Thread Oscar Benjamin
On Wed, 7 Nov 2018 at 18:35, Alan Gauld via Tutor wrote: > > On 07/11/2018 14:48, Albert-Jan Roskam wrote: > > > What is the best way to dynamically set class variables? > > I think I'm maybe missing the point of your question? I think you are as well :) IIUC then the question is: how can I

Re: [Tutor] What is the best way for a program suite to know where it is installed?

2018-10-21 Thread Oscar Benjamin
(Resending to the list - sorry for the duplicate, Bob) On Sun, 21 Oct 2018 at 04:02, boB Stepp wrote: > > I was just re-reading the entire thread at > https://www.mail-archive.com/tutor@python.org/msg77864.html > And I have asked similar questions previous to that thread. I still > do not

Re: [Tutor] Statistics with python

2018-10-14 Thread Oscar Benjamin
I'm replying back to the tutor list. Can you reply there rather than directly to me please? Also I've moved your response below mine as that is the preferred style on this list. My answer is below. On Sun, 14 Oct 2018 at 16:05, Mariam Haji wrote: > > On Sat, Oct 13, 2018 at 10:24 PM

Re: [Tutor] Statistics with python

2018-10-13 Thread Oscar Benjamin
On Sat, 13 Oct 2018 at 11:23, Mariam Haji wrote: > > Hi guys, Hi Mariam > the question is as: > If a sample of 50 patients is taken from a dataset what is the probability > that we will get a patient above the age of 56? I can think of several ways of interpreting this: (a): You have a

Re: [Tutor] Spyder - How to determine files that appear at start-up

2018-10-08 Thread Oscar Benjamin
On Mon, 8 Oct 2018 at 13:18, Shall, Sydney via Tutor wrote: > > My question concerns Spyder. I know that this is a Python list, but I > also see that some people here also use Spyder. So, please forgive me. > > My problem is simple. I cannot find out how I can determine the set of > files that

Re: [Tutor] Fwd: How to roughly associate the values of two numpy arrays, or python lists if necessary

2018-09-20 Thread Oscar Benjamin
Sydney wrote and Alan forwarded: > > I have, I suspect, an elementary problem that I am too inexperienced to > resolve. > > I have two numpy arrays, each representing the values of a specific > property of a set of cells. > > Now, I want to associate the two values for each cell, that is for each

Re: [Tutor] building package on mac os

2018-09-10 Thread Oscar Benjamin
Hi Glen, I feel like I would be able to offer you some help but you haven't provided precise enough information for me to know exactly what your problem is. On Mon, 10 Sep 2018 at 00:02, Glenn Schultz via Tutor wrote: > > I have a package that I am working on. I am using Pycharm. The

Re: [Tutor] Problem compiling code from GitHub

2018-08-29 Thread Oscar Benjamin
On Mon, 27 Aug 2018 at 13:18, Dave Hill wrote: > > I have found 'odswriter' on GitHub > https://github.com/mmulqueen/odswriter which appears to provide what I > want. However, I have come to a halt, due to the limitation of my knowledge. > > I admit that I am confounded as to where/how to access

Re: [Tutor] Recommended way for end users to run our Python programs?

2018-08-22 Thread Oscar Benjamin
On Fri, 17 Aug 2018 at 09:38, Matthew Polack wrote: > > We're enjoying learning Python in our school...but I have a question > regarding the way the end users should ideally run the software. > > Does this always require Python being installed as a full language on the > end users computer? It's

Re: [Tutor] try, except syntax

2018-08-02 Thread Oscar Benjamin
On 2 August 2018 at 15:29, Shall, Sydney wrote: > > try: > type(uvc) == float > except TypeError as e: > print(e, msg) Let's try this interactively: >>> uvc = 2 >>> type(uvc) >>> type(uvc) == float False So calling type(uvc) doesn't raise an error. It returns the type "int". You then

Re: [Tutor] Removing duplicates

2018-08-02 Thread Oscar Benjamin
On 2 August 2018 at 13:49, Peter Otten <__pete...@web.de> wrote: > Oscar Benjamin wrote: >> >> Comparing floats for equality can be flakey. Sometimes two floats that >> should be equal will not compare equal e.g.: >> >>>>> 0.01 + 0.1 - 0.1 =

Re: [Tutor] Removing duplicates

2018-08-02 Thread Oscar Benjamin
On 1 August 2018 at 21:38, Roger Lea Scherer wrote: > > I'm trying to get a list of tuples to be a float, a numerator, and a > denominator for all the fractions: halves, thirds, fourths etc up to > ninths. 1/2 returns the same float as 2/4, 3/6, 4/8. I would like to keep > only the 1/2. When I

Re: [Tutor] please help me modify this code so that I can utilize raw_input

2016-10-05 Thread Oscar Benjamin
On 4 October 2016 at 19:11, Alan Gauld via Tutor wrote: >> """Define a function sum() and a function multiply() that sums and >> multiplies (respectively) all the numbers in a list of numbers. For >> example, sum([1, 2, 3, 4]) should return 10, and multiply([1, 2, 3, 4]) >>

Re: [Tutor] help with Numpy

2016-09-22 Thread Oscar Benjamin
On 22 September 2016 at 04:47, eryk sun <eryk...@gmail.com> wrote: > On Wed, Sep 21, 2016 at 10:35 PM, Oscar Benjamin > <oscar.j.benja...@gmail.com> wrote: >> I would have given the same advice a year or so ago. It's worth noting >> though that the situation wi

Re: [Tutor] help with Numpy

2016-09-21 Thread Oscar Benjamin
On 21 Sep 2016 22:29, "Alan Gauld via Tutor" wrote: > > On 21/09/16 15:53, Paul Dentinger wrote: > > Hello, > > Sorry for such a basic question, but I am trying to get Numpy to work. I > > have python 3.5 and working in IDLE. I need Numpy and Scipy and may need > > matplotlib.

Re: [Tutor] Coding help 1D diffusion equation

2016-06-28 Thread Oscar Benjamin
On 26 Jun 2016 13:39, "Severin Langberg" wrote: > > Hello! > > I have a problem with solving the 1D diffusion equation for Gaussian > initial using odeint. Anyone care to help? Odeint is for ordinary differential equations (ODEs). The diffusion equation is a partial

Re: [Tutor] Semantic Error: Trying to access elements of list and append to empty list with for loop

2016-06-02 Thread Oscar Benjamin
On 2 June 2016 at 19:19, Olaoluwa Thomas wrote: > Thanks, everyone, for your help. > > The objective was to extract all words from each line and place them in a > list IF they didn't already exist in it. > I sorted it out by adding little bits of everyone's suggestions.

Re: [Tutor] Rate transition from 60hz to 1000hz

2016-05-10 Thread Oscar Benjamin
On 10 May 2016 at 04:08, David Wolfe wrote: > Good Evening; > > I'm collecting both video and force plate data, and I need to be able to > synchronize the two, so I can make some calculations. The video data is at > 60hz, and the force plate data is at 1000hz. I don't want to

Re: [Tutor] Extracting bits from an array

2016-04-30 Thread Oscar Benjamin
On 30 Apr 2016 08:14, "Peter Otten" <__pete...@web.de> wrote: > > Peter Otten wrote: > > > Anish Kumar wrote: > > > >> Right shifting is well defined in Python? > > > > Yes. What might surprise someone used to fixed-size integers: > > > -1 >> 1 > > -1 > > > > Any negative int will eventually

Re: [Tutor] Detect the folder of a file

2016-04-28 Thread Oscar Benjamin
On 28 April 2016 at 11:11, Steven D'Aprano <st...@pearwood.info> wrote: > On Thu, Apr 28, 2016 at 09:57:19AM +0100, Oscar Benjamin wrote: > >> You can write some code to test if a particular path represents the >> base directory of a virtual environment but I expect it woul

Re: [Tutor] Detect the folder of a file

2016-04-28 Thread Oscar Benjamin
On 28 April 2016 at 02:02, Kanika Murarka wrote: > Thanks Oliver and Alex, I didnt know about these commands :D > > Oliver, > When i typed > print filename > print sys.executable > print sys.prefix > print

Re: [Tutor] question about __copy__ and __deepcopy__

2016-04-15 Thread Oscar Benjamin
On 15 April 2016 at 10:48, Albert-Jan Roskam wrote: > What I like about both namedtuple and AttrDict is attribute lookup: that > makes code so, so, s much easier to read. This seems to be a nice > generalization of your code: > > class Point(object): > > def

Re: [Tutor] question about __copy__ and __deepcopy__

2016-04-15 Thread Oscar Benjamin
On 15 April 2016 at 09:55, Albert-Jan Roskam wrote: > > Heh, it's my fancy __str__ method that confused me. This is what I get when I > run my code without __copy__ and __deepcopy__ > runfile('/home/albertjan/Downloads/attrdict_tutor.py', >

Re: [Tutor] question about __copy__ and __deepcopy__

2016-04-14 Thread Oscar Benjamin
On 14 April 2016 at 20:38, Albert-Jan Roskam wrote: > Hi, > > Lately I have been using the "mutable namedtuple" shown below a lot. I found > it somewhere on StackOverflow or ActiveState or something. > In its original form, it only had an __init__ method. I don't know

Re: [Tutor] Best tool for programming interactive games in Python

2016-03-31 Thread Oscar Benjamin
On 30 March 2016 at 00:26, Alan Gauld <alan.ga...@btinternet.com> wrote: > On 29/03/16 22:17, Oscar Benjamin wrote: >> >> On 29 Mar 2016 22:20, "Alan Gauld" <alan.ga...@btinternet.com >> <mailto:alan.ga...@btinternet.com>> wrote: >> >>

Re: [Tutor] Best tool for programming interactive games in Python

2016-03-29 Thread Oscar Benjamin
On 29 Mar 2016 22:20, "Alan Gauld" wrote: > > PyGin and Albow are other games based frameworks you could > investigate. And of course there is OpenGL which plays very > well with MacOSX. OpenGL plays nicely with Windows and Linux as well. I think that pygame actually

Re: [Tutor] Best tool for programming interactive games in Python

2016-03-29 Thread Oscar Benjamin
On 29 Mar 2016 21:19, "Bob Gailer" wrote: > > On Mar 29, 2016 2:03 PM, "Lisa Hasler Waters" wrote: > > > > I continually get this error: > > > > > > Traceback (most recent call last): > > File "/Users/lwaters/Desktop/pygameTest.py", line 1, in > >

Re: [Tutor] Advice on multi-dimensional data storage

2016-03-20 Thread Oscar Benjamin
On 16 March 2016 at 13:21, Steven D'Aprano wrote: > On Wed, Mar 16, 2016 at 08:36:59AM +, Matt Williams wrote: >> Dear Tutors, >> >> I am looking for some advice. I have some data that has three dimensions to >> it. I would like to store it such that one could manipulate

Re: [Tutor] Pmw/Tkinter question

2016-03-13 Thread Oscar Benjamin
On 13 Mar 2016 23:25, "boB Stepp" wrote: > > On Sun, Mar 13, 2016 at 6:06 PM, boB Stepp wrote: > > On Sun, Mar 13, 2016 at 11:01 AM, Albert-Jan Roskam > > wrote: > >> > > > >>

Re: [Tutor] Convert structured 1D array to 2D array

2016-02-28 Thread Oscar Benjamin
On 26 February 2016 at 16:46, Ek Esawi wrote: > > I used genfromtxt to read a file with multiple data types. The result was a > 1D array of tuples; for example > > [(1, 2, 3), (‘a’, b’, ’c’), (‘12/12/2009’, ’2/4/2014’, ‘3/4/200)’] > > > > I am trying to convert this structured

Re: [Tutor] asyncio or threading

2016-02-17 Thread Oscar Benjamin
On 16 February 2016 at 02:24, Danny Yoo wrote: > > where we pass function objects around to the function that will take a > long time to finish its work. We expect our callback functions to be > "called back" later by some party after some point. In many > asynchronous

Re: [Tutor] Enumerate vs DictReader object manipulation:

2016-02-04 Thread Oscar Benjamin
On 4 February 2016 at 06:45, Matt Williams wrote: > > Just as a note - you are not the only person caught out by this - it is a > very common slip. > > I wonder whether it would be worth adding a more explicit line about this > in the Python Docs? Where in the docs

Re: [Tutor] Enumerate vs DictReader object manipulation:

2016-02-04 Thread Oscar Benjamin
On 4 February 2016 at 03:21, Ben Finney wrote: > Alex Kleider writes: > >> How does a dict fit into this scheme? >> Is it a sequence? > > No, a dict is not a sequence. But it is a container: all its items > remain available and can be retrieved

Re: [Tutor] lc_ctype and re.LOCALE

2016-02-01 Thread Oscar Benjamin
On 31 January 2016 at 21:41, Albert-Jan Roskam wrote: >> > >> > >> > You're looping over all pairs of locales: >> > >> > Suppose there are N locales and M is sys.maxunicode. The number of >> > pairs of locales is N*(N-1)/2 which grows like N**2. For each pair you >> >

Re: [Tutor] Finding the max value from a dictionary that does not exceed a variable's value.

2016-02-01 Thread Oscar Benjamin
On 31 January 2016 at 05:50, srinivas devaki wrote: > On Sun, Jan 31, 2016 at 3:54 AM, Danny Yoo wrote: >> --- >> I want to take the max value in the dictionary 'coinvalues' that is the >> same as or lower than the variable 'change'. I have

Re: [Tutor] Finding the max value from a dictionary that does not exceed a variable's value.

2016-02-01 Thread Oscar Benjamin
On 1 February 2016 at 13:29, Steven D'Aprano wrote: >> > although OP's problem doesn't need this, is there a better way achieve >> > this other than >> > using a balanced binary search tree. >> >> You would need to state all of the requirements for your data >> structure. If

Re: [Tutor] lc_ctype and re.LOCALE

2016-01-29 Thread Oscar Benjamin
On 28 January 2016 at 20:23, Albert-Jan Roskam wrote: > > Out of curiosity, I wrote the throw-away script below to find a character > that is classified (--> LC_CTYPE) as digit in one locale, but not in another. > I ran it with 5000 locale combinations in Python 2 but

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-28 Thread Oscar Benjamin
On 27 January 2016 at 23:00, Ek Esawi wrote: > Ops..here is the text file.; previously i copied and pasted from either > Word or Excel. > > > AA,BB,CC,DD,EE > 1,A1,B1,11.2,11/20/2011 > 2,A2,B2,2.5,10/21/2011 > 3,A3,B3,13.67,9/21/2011 > 4,A4,B4,14.2,8/22/2011 >

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-27 Thread Oscar Benjamin
On 27 January 2016 at 02:00, Ek Esawi wrote: > Here is the file. > > AA,BB,CC,DD,EE > > 1,A1,B1,11.2,11/20/2011 > > 2,A2,B2,2.5,10/21/2011 > > 3,A3,B3,13.67,9/21/2011 > > 4,A4,B4,14.2,8/22/2011 > > 5,A5,B5,20,7/23/2011 That still doesn't look right to me. Is there really a

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-26 Thread Oscar Benjamin
On 26 January 2016 at 03:07, Ek Esawi wrote: > > Here is a copy of my code and the csv file. > ++ csv file++ > > AA > > BB > > CC This doesn't look like a csv file. Is that what the actual contents of the csv file looks like if you open it in a *text editor*? If this was a

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-26 Thread Oscar Benjamin
On 26 Jan 2016 19:32, "Ek Esawi" wrote: > > Sorry! but it's a csv file. I just copied it directly from an opened csv > file in excel. And you're correct it looks like what you wrote. EKE Can you show exactly how it looks? I.e. open it in a text editor and paste the first say

Re: [Tutor] Why is an OrderedDict not sliceable?

2016-01-25 Thread Oscar Benjamin
On 24 January 2016 at 20:29, Albert-Jan Roskam wrote: >> I guess that the authors of OrderedDict just didn't really consider >> this to be very useful. Apart from having ordered iteration >> OrderedDict is not really that deeply thought out. There's a thread on >>

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-25 Thread Oscar Benjamin
On 25 January 2016 at 13:14, Peter Otten <__pete...@web.de> wrote: >> What do you mean by "group rows"? > > Given a table you can specify columns as keys and in the simplest case one > column where you apply an aggregate function over the sets of rows with the > same key. > > If I understand you

Re: [Tutor] Change datatype for specific columns in an 2D array & computing the mean

2016-01-25 Thread Oscar Benjamin
On 24 January 2016 at 17:24, Peter Otten <__pete...@web.de> wrote: > > I'm an amateur with numpy, and unfortunately my favourite search engine > didn't come up with a numpy-specific way to group rows in a 2D array. What do you mean by "group rows"? I thought the OP's problem is really to filter

Re: [Tutor] Why is an OrderedDict not sliceable?

2016-01-25 Thread Oscar Benjamin
On 24 January 2016 at 19:47, Albert-Jan Roskam wrote: >> >> You appear to be confusing ordered and sorted. > You are correct. Is there a difference in the way those terms are used > colloquially vs. in the field of Computer Science (Note: English is not my > mother

Re: [Tutor] Why is an OrderedDict not sliceable?

2016-01-21 Thread Oscar Benjamin
On 21 January 2016 at 09:19, Ben Finney wrote: > Albert-Jan Roskam writes: > >> Why is an OrderedDict not sliceable? > > Because slicing implies index access. The built-in ‘dict’ and > ‘collections.OrderedDict’ both do not support indexed

Re: [Tutor] Extract several arrays from a large 2D array

2016-01-21 Thread Oscar Benjamin
On 21 January 2016 at 04:22, Ek Esawi wrote: > I have a 2D array (2000, 4); Do you mean a numpy array? I'm going to assume that you do. > an example is given abelow. On the 1st column > I have 15 variables, on the 2nd 4 variables. Ignore column 3 for now. I > want a code

Re: [Tutor] Should a "data" directory have a __init__.py file?

2016-01-18 Thread Oscar Benjamin
On 18 January 2016 at 04:27, Ben Finney wrote: > > The module import system will only recognise a directory as a “package” > (Python's technical term for “a point in the import hierarchy which > contains other things to import”) if that directory contains a file >

Re: [Tutor] How (and whether I should) use pkgutil.get_data()?

2016-01-18 Thread Oscar Benjamin
On 17 January 2016 at 23:37, boB Stepp wrote: > 1) Is using pkgutil.get_data() the way I should be reading my data files? Generally yes, although it may be unnecessary. The main purpose of pkgutil.get_data is to transparently handle the case where your packages are

Re: [Tutor] me, my arm, my availability ...

2016-01-14 Thread Oscar Benjamin
On 13 January 2016 at 20:47, Laura Creighton wrote: > > Seems like surgery is needed to fix this. > > So I wanted you all to know, no, I haven't forgotten you and no haven't > stopped caring. I have just stopped being as __capable__ if you know > what I mean. > > Please take

Re: [Tutor] Question about the memory manager

2016-01-11 Thread Oscar Benjamin
On 11 January 2016 at 12:15, Alan Gauld wrote: > > But I think that it definitely is heavily OS dependent. > It should work in most *nix environments the first time > you call the function. But on second call I'd expect > all bets to be off. And in most real-time OS's

Re: [Tutor] Question about the memory manager

2016-01-11 Thread Oscar Benjamin
On 11 January 2016 at 15:40, Peter Otten <__pete...@web.de> wrote: >> I can't even work out how you trigger a MemoryError on Linux (apart >> from just raising one). I've tried a few ways to make the system run >> out of memory and it just borks the system rather than raise any error >> - I can

Re: [Tutor] OT: How to automate user interactions with GUI elements of closed-source programs?

2015-12-24 Thread Oscar Benjamin
On 24 Dec 2015 14:55, "boB Stepp" wrote: > > My Google-fu is weak on this question. I keep getting lots of hits on > web scraping, but my interest is actually as follows: > > I find myself doing the same boring, repetitive tasks by hand, which > amounts to copying certain

Re: [Tutor] Understanding a linear runtime implementation of anagram detection

2015-12-14 Thread Oscar Benjamin
On 10 December 2015 at 12:38, Spyros Charonis wrote: > Dear All, > > I am learning about analysis of algorithms (python 2.7.6). I am reading a > book (Problem solving with Algorithms and Data Structures) where Python is > the language used for implementations. The author

Re: [Tutor] Help with returning a list object from a C extension.

2015-11-28 Thread Oscar Benjamin
On 28 Nov 2015 12:06, "James Oren" wrote: > > Hi all, this is my first time using the mailing list. > > I'm trying to learn how to use C to extend my code, and have already worked > out how to use ctypes. I'm now trying to learn the full C extension module > approach

Re: [Tutor] a class that may not be instantiated

2015-11-24 Thread Oscar Benjamin
On 24 November 2015 at 15:36, Albert-Jan Roskam wrote: > Hi, > > I have two classes with a number of methods that are the same, so I want to > define a super class that holds these methods. But the super class (below > called _Generic) should not be instantiated,

Re: [Tutor] How to kill a thread

2015-11-23 Thread Oscar Benjamin
On 23 November 2015 at 01:42, CMG Thrissur wrote: > Is the below text in plain text? I am using thunderbird. No it isn't. I've kept the first part of it so you can see how it looks: > import datetime import time import mysql.connector import threading import > pythonwhois

Re: [Tutor] unittest not working

2015-11-19 Thread Oscar Benjamin
On 19 November 2015 at 13:25, Mike wrote: > I'm trying to unit test a self-built regular expression processor for an > assignment. I'm trying to set up unit tests for the package, but it's not > executing them. This is my first time trying to use the unittest module, so >

Re: [Tutor] Plotting with python

2015-11-03 Thread Oscar Benjamin
On 31 October 2015 at 00:00, Terry Carroll wrote: > If you were going to get started doing some simple plotting with Python 2.7 > (in my case, I'm simply plotting temperature against time-of-day) what would > you use? > > - matplotlib [1] > - gnuplot [2] > - something else

Re: [Tutor] 0 > "0" --> is there a "from __future__ import to make this raise a TypeError?

2015-10-12 Thread Oscar Benjamin
On Mon, 12 Oct 2015 17:15 Albert-Jan Roskam wrote: Hi, In Python 2 one can do silly apple-pear comparisons such as 0> "0".*) "CPython implementation detail: Objects of different types except numbers are ordered by their type names; objects of the same types that don’t

Re: [Tutor] FrozenDict

2015-10-08 Thread Oscar Benjamin
On 8 October 2015 at 01:47, Steven D'Aprano wrote: > In 3.3, you will have a problem that FrozenDict is not a proper > iterator. You can't set self.__next__ = self.next, that won't work. > Dunder methods have to be on the class, not on the instance, so instead > of making the

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

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

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 >

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')

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

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

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 <tutor@python.org> 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 t

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,

Re: [Tutor] find pickle and retrieve saved data

2015-08-05 Thread Oscar Benjamin
On 4 August 2015 at 23:09, Quiles, Stephanie stephanie.quiles...@albright.edu 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

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 robertvst...@gmail.com 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

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 colin.ross@gmail.com 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:

Re: [Tutor] Pytest help

2015-07-07 Thread Oscar Benjamin
On Tue, 7 Jul 2015 at 09:51 Sahil Chauhan sahil4...@gmail.com 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

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 st...@pearwood.info 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

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

2015-07-03 Thread Oscar Benjamin
On 3 July 2015 at 00:47, Ben Finney ben+pyt...@benfinney.id.au 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

Re: [Tutor] Problem in packages

2015-07-01 Thread Oscar Benjamin
On 1 July 2015 at 07:11, megha garg meghagarg1...@gmail.com 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

Re: [Tutor] Yielding from a with block

2015-05-29 Thread Oscar Benjamin
On 29 May 2015 at 13:38, Steven D'Aprano st...@pearwood.info 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

Re: [Tutor] Yielding from a with block

2015-05-29 Thread Oscar Benjamin
On 29 May 2015 at 14:29, Steven D'Aprano st...@pearwood.info 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

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): yield from

Re: [Tutor] Question About Image Processing in Python

2015-05-28 Thread Oscar Benjamin
On 28 May 2015 at 11:34, Serge Christian Ibala christian.ib...@gmail.com 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

Re: [Tutor] Yielding from a with block

2015-05-28 Thread Oscar Benjamin
On 28 May 2015 at 03:12, Steven D'Aprano st...@pearwood.info 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(): with open('co2-sample.csv

[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] 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 I did this

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: with

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

2015-05-05 Thread Oscar Benjamin
On 4 May 2015 at 20:04, WolfRage wolfrage8...@gmail.com 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

Re: [Tutor] Fwd: circular movement in pygame

2015-04-28 Thread Oscar Benjamin
On 28 April 2015 at 16:38, diliup gabadamudalige dili...@gmail.com 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

Re: [Tutor] Fwd: circular movement in pygame

2015-04-28 Thread Oscar Benjamin
On 28 April 2015 at 19:37, diliup gabadamudalige dili...@gmail.com 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

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 smar...@gmail.com 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

Re: [Tutor] bin to dec conversion puzzlement

2015-04-20 Thread Oscar Benjamin
On 20 April 2015 at 08:44, Jim Mooney cybervigila...@gmail.com 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

  1   2   3   4   >