[Tutor] unittest with random population data

2015-05-30 Thread Sydney Shall
MAC OSX 10.10.3 Enthought Python 2.7 I am an almost beginner. Following advice from you generous people, I have chosen a project that interests me, to develop some knowledge of python. My projest is a simulation of a biological population. I have a base class and a simulation function, which u

Re: [Tutor] unittest with random population data

2015-06-02 Thread Sydney Shall
On 02/06/2015 07:59, Steven D'Aprano wrote: Please keep your replies on the tutor list, so that others may offer advice, and learn from your questions. Thanks, Steve On Mon, Jun 01, 2015 at 06:03:08PM +0100, Sydney Shall wrote: On 31/05/2015 00:41, Steven D'Aprano wrote: On S

Re: [Tutor] unittest with random population data

2015-06-02 Thread Sydney Shall
On 31/05/2015 03:00, Cameron Simpson wrote: On 30May2015 12:16, Sydney Shall wrote: Following advice from you generous people, I have chosen a project >that interests me, to develop some knowledge of python. My projest is a simulation of a biological population. I have a base class an

Re: [Tutor] idle??

2016-01-14 Thread Sydney Shall
On 13/01/2016 23:10, Danny Yoo wrote: So, where does IDLE fit into this IDLE is a sad little “IDE”, which is really ugly, because it’s written in Tk. It lacks many IDE features. It comes with a really basic debugger (that doesn’t even highlight the line that is being currently executed…), f

[Tutor] Fasta Identy

2016-03-08 Thread Sydney Shall
Dear Ali, I suggest your best way is to use the resource at the EMBL or the National Library of Congress, NIH, resources. There you can compare your FASTA sequences with authentic databases. The programs know about FASTA and will recognise the format. It will identify the gene for you. And i

Re: [Tutor] genfromtxt and dtype to convert data to correct format

2016-05-18 Thread Sydney Shall
On 18/05/2016 14:14, Ek Esawi wrote: OPS! Sorry, I made a mistake on the posting. My output is in a string format as shown below. I want the 1st and 8th integers, the 3rd string which is OK as, the 2nd date and the rest time. I tried several combinations of dtype but could not get the date and ti

[Tutor] How to extract a float from an instancemethod call

2013-04-08 Thread Sydney Shall
e 163, in isPositionInRoom return self.room[(int(x), int(y))] in self.room TypeError: int() argument must be a string or a number, not 'instancemethod' >>> RESTART I would be grateful for any guidance. -- Sydney Shall ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to extract a float from an instancemethod call

2013-04-14 Thread Sydney Shall
On 08/04/2013 13:52, Dave Angel wrote: On 04/08/2013 08:40 AM, Sydney Shall wrote: Hi, I am learning Python. I use MAC OSX 10.6.8 Python 2.7.3 I have been given a project to write a program involving random walks. I have drafted a program which has passed all the static tests, but on

[Tutor] totalViruses[i] /= float(numTrials),

2013-04-24 Thread Sydney Shall
//I am a beginner just learning Python. I have come across the following usage for the first time. totalViruses[i] /= float(numTrials) Does it mean? ; totalViruses[i] = totalViruses[i]/float(numTrials) -- Sydney ___ Tutor maillist - Tutor@python.

Re: [Tutor] [OT] Programming practice was: Re: string list in alphabetical!

2013-10-22 Thread Sydney Shall
ution ..'? I am not clear how this differs from pseudo code design. Thanks to you all for your generous and always invaluable help. Sydney -- Sydney Shall ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] FASTA parsing, biological sequence analysis

2014-03-25 Thread Sydney Shall
library. It will handle a lot of issues that you are not considering, including memory consumption and correct, stream-oriented parsing of FASTA. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.

Re: [Tutor] FASTA parsing, biological sequence analysis

2014-03-25 Thread Sydney Shall
On 25/03/2014 15:55, Steven D'Aprano wrote: On Tue, Mar 25, 2014 at 03:36:12PM +0000, Sydney Shall wrote: I did not know about biopython, but then I am a debutant. I tried to import biopython and I get the message that the name is unknown. I am using Enthought Python 2.7.3on MAC OS X1

[Tutor] unittests

2014-04-01 Thread Sydney Shall
se: square_root(0). Write the test case. Run it. You'll see something interesting. Good luck! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor -- Sydney Shall __

Re: [Tutor] unittests

2014-04-04 Thread Sydney Shall
code that's broken, so it gives a quick canary-in-the-coalmine. If you want to explore this more, check for Kent Beck's: "Test-driven Development: By Example". ___ Tutor maillist - Tutor@python.org To u

Re: [Tutor] unittests

2014-04-04 Thread Sydney Shall
On 04/04/2014 14:55, Albert-Jan Roskam wrote: - Original Message - From: Sydney Shall To: tutor@python.org Cc: Sent: Friday, April 4, 2014 3:12 PM Subject: Re: [Tutor] unittests I would like to thank both Steven and Danny for their explanations. They were much easier for me to

[Tutor] pylab axis

2014-05-29 Thread Sydney Shall
e, so I have attached the pdf file of the graph. Please guide me on this too. My problem is that I wish to force the y axis to simply be from 0.0 to 1.5 without the detail which is just arithmetic noise, I think. With thanks, Sydney -- Sydney Shall Figure10.pdf D

[Tutor] How does one construct a module for import?

2014-06-02 Thread Sydney Shall
that you have a folder like this inside the python27 folder: python27 +-- [other python files] +-- swampy +-- World.py but you need this: python27 +-- [other python files] +-- swampy +-- __init__.py +-- World.py If this is not what you have, you will

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Sydney Shall
this file? With many thanks, Sydney On 02/06/2014 14:52, Alan Gauld wrote: On 02/06/14 13:21, Sydney Shall wrote: I do not really understand what Steven is recommending below. Is it an init statement in a file or is it an independent file. It is an independent file (which can be empty) whose

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Sydney Shall
ry. But that is what I thought I had done. Do I undestand correctly that what I need to do is to have a single directory, say called MyModule, in the directory site-packages. And then I need to copy just once each of the two function files that I want to be importable? Once again, many thanks

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Sydney Shall
at 05:08:21PM +0100, Sydney Shall wrote: Thanks for the detailed reply, Steven. It seems that you have correctly identified my prblem. But I am still puzzled, because I do not know how this happened. I simply copied the two files that I wished to import to a directory called (nowMyModule). I

Re: [Tutor] Tips

2014-06-18 Thread Sydney Shall
many thanks. -- Sydney Shall ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tips

2014-06-19 Thread Sydney Shall
On 19/06/2014 03:37, Steven D'Aprano wrote: On Wed, Jun 18, 2014 at 12:35:20PM +0200, Sydney Shall wrote: On 17/06/2014 22:35, Alan Gauld wrote: Use modules instead of singleton classes As a new beginner with Python, I am having problem understanding the difference here. I think I under

[Tutor] A beginner having problems with inheritance

2014-07-01 Thread Sydney Shall
correctly recognised. Perhaps, I need to read more about inheritance, Any suggestions for reading would be welcome. With many thanks. -- Sydney Shall ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https

Re: [Tutor] A beginner having problems with inheritance

2014-07-02 Thread Sydney Shall
On 01/07/2014 19:04, Sydney Shall wrote: I am a beginner and I have always had problems with inheritance. I can get inheritance to work with very simple classes. But with more complex classes, I find that inheritance seems to work for simple variables, but I cannot get it to work with lists or

Re: [Tutor] A beginner having problems with inheritance

2014-07-09 Thread Sydney Shall
was then a very obscure error because the wrong calculation was performed and later on an array was empty. Fortunately, thanks to you very generous tutors I have learned to read the error trace very carefully indeed. Thanks a lot. Sydney -- Sydney Shall ___

Re: [Tutor] A beginner having problems with inheritance

2014-07-10 Thread Sydney Shall
thon.org/2/tutorial/classes.html#private-variables-and-class-local-references Good luck! Thanks for the reply. I had read the second reference that you gave some time ago, but of course I had forgotten about it. I shall try and make use of it no

[Tutor] Use of "getter" and "setter" attributes

2014-09-08 Thread Sydney Shall
ython.org/mailman/listinfo/tutor I was taught to [generally] always use getter and setter, and I have found this clear and useful. But I am a beginner, so my question is whether there there are any other reasons to use the methods outlined above by the always helpful Danny Yoo, in addition to the

Re: [Tutor] Good approach regarding classes attributes

2014-09-09 Thread Sydney Shall
class User: A simple question from a newbie, in response to this surprise. Is it not helpful to always put (object) as the parent, if the class is not itself a sub-class? And while I am writing, what does OP stand for in this list? -- Sydney Shall ___

Re: [Tutor] Good approach regarding classes attributes

2014-09-09 Thread Sydney Shall
On 09/09/2014 15:44, Peter Otten wrote: Sydney Shall wrote: On 08/09/2014 18:39, Alan Gauld wrote: On 08/09/14 15:17, Juan Christian wrote: One tiny tweak... class User(): You don't need the parens after User. You don;t have any superclasses so they do nothing. Python convention f

Re: [Tutor] Good approach regarding classes attributes

2014-09-09 Thread Sydney Shall
On 09/09/2014 16:05, Joel Goldstick wrote: On Tue, Sep 9, 2014 at 10:02 AM, Sydney Shall wrote: On 09/09/2014 15:44, Peter Otten wrote: Sydney Shall wrote: On 08/09/2014 18:39, Alan Gauld wrote: On 08/09/14 15:17, Juan Christian wrote: One tiny tweak... class User(): You don't nee

[Tutor] list comprehension with else

2015-01-18 Thread Sydney Shall
I am a beginner and I have a question of syntax. I am just learning to use list comprehension, which oc course, I find very helpful indeed. However, I am stuck with a specific problem of how to incorporate an else in a list comp-rehension. I cannot do it. The following snippet of code does

Re: [Tutor] list comprehension with else

2015-01-18 Thread Sydney Shall
On 18/01/2015 13:20, Sydney Shall wrote: I am a beginner and I have a question of syntax. I am just learning to use list comprehension, which oc course, I find very helpful indeed. However, I am stuck with a specific problem of how to incorporate an else in a list comp-rehension. I cannot do

Re: [Tutor] list comprehension with else

2015-01-18 Thread Sydney Shall
On 18/01/2015 13:41, Asokan Pichai wrote: On Sun, Jan 18, 2015 at 6:50 PM, Sydney Shall mailto:s.sh...@virginmedia.com>> wrote: I am a beginner and I have a question of syntax. Welcome! I am just learning to use list comprehension, which oc course, I find very helpful

Re: [Tutor] list comprehension with else

2015-01-19 Thread Sydney Shall
On 19/01/2015 00:55, Steven D'Aprano wrote: On Sun, Jan 18, 2015 at 02:20:55PM -0800, Danny Yoo wrote: Just to add, log(0) is mathematically undefined. https://en.m.wikipedia.org/wiki/Logarithm. For the record, IEEE-754 specifies that log(0.0) should return -INF. That's what Decimal does: py>

[Tutor] Installing psutil 2.2.0-1 on Canopy Enthought

2015-01-22 Thread Sydney Shall
I use MAC OSX 10.9.5 Canopy Enthought python 2.7.6 I also use the Enthought Package Manager to keep my installation up-todate. For about two weeks now, Canopy says that I need to install psutil 2.2.0-1 instead of the currently installed version 2.1.1. I appear to do that successfully, but the n

Re: [Tutor] Installing psutil 2.2.0-1 on Canopy Enthought

2015-01-23 Thread Sydney Shall
On 22/01/2015 22:53, Alan Gauld wrote: On 22/01/15 12:56, Sydney Shall wrote: I use MAC OSX 10.9.5 Canopy Enthought python 2.7.6 I also use the Enthought Package Manager to keep my installation up-todate. Canopy and Enthoughts paqckage management are well beyond the bounds of standard

Re: [Tutor] Tutor Digest, Vol 131, Issue 59 Order loop from methos on class (jarod...@libero.it)

2015-01-26 Thread Sydney Shall
On 26/01/2015 14:41, Dino Bektešević wrote: 2015-01-26 14:54 GMT+01:00 jarod...@libero.it : Thanks so much!! Now I understood it is a stupid thing! So, could you elpme to decompose the problem? I initiazlizate the class with the file to use so all the function have all the parameters that I need

Re: [Tutor] OT: Preferred email client for sending plain text programming code snippets

2015-02-18 Thread Sydney Shall
On 18/02/2015 03:48, Mark Lawrence wrote: On 17/02/2015 23:23, boB Stepp wrote: Hopefully this is not a touchy subject like Emacs vs. Vim. ~(:>)) My home PC uses Win7-64bit. I currently use Chrome, Gmail and have a Nexus 5 phone. The nice thing about all of this is that all of my information us

[Tutor] unittest for: Raises an exception

2015-02-18 Thread Sydney Shall
I use a MAC OSX 10.9.5 Enthought Canopy Python 2.7.6 I am a learner. I am now trying to learn unittests as is often emphasised on this list. I think that I have understood the simple unit tests such as Equal, Greater etc. But I am struggling with the syntax of a test for Raises an exception.

Re: [Tutor] unittest for: Raises an exception

2015-02-19 Thread Sydney Shall
On 18/02/2015 20:40, Ben Finney wrote: Sydney Shall writes: My test code is the following: def test_func_getSurplusLabourTime_Exc(self): self.assertRaises(ValueError,self.cwp.getSurplusLabourTime(self.cwp.ww,self.cwp.uvc)) [This last line should indented, but it refuses to do so!] What

[Tutor] What exactly is "state"?

2015-03-02 Thread Sydney Shall
I am a beginner and I am now at the strage of learning to write unittests. I have followed the current discussion entitled "How to test a class in pyhton", and I am not clear precisely what is meant by state. In its common meaning I can see some relevance. But is there a technical aspect to the

Re: [Tutor] What exactly is "state"?

2015-03-02 Thread Sydney Shall
On 02/03/2015 18:03, Dave Angel wrote: On 03/02/2015 11:25 AM, Sydney Shall wrote: I am a beginner and I am now at the strage of learning to write unittests. I have followed the current discussion entitled "How to test a class in pyhton", and I am not clear precisely what is meant by

[Tutor] How to write the __str__ function

2017-05-14 Thread Sydney Shall
I need some advice that I have been embarrased to ask for, because I think that my error is so elementary. I have written, as advised by the tutors, a complex program in a topic that interests me. The program works well and the tests are OK. Now I want to add a __str__ function, which I thoug

Re: [Tutor] How to write the __str__ function

2017-05-15 Thread Sydney Shall
On 15/05/2017 01:27, Alan Gauld via Tutor wrote: On 14/05/17 19:03, Sydney Shall wrote: The code that I have so far is as folows: def __str__(self): return("\n" " Output from __str__ of POCWP. " "\n"

[Tutor] unitest with random inputs

2017-07-19 Thread Sydney Shall
I am learning to use unittest. I have written a program that runs as it should. 247 tests give me a satisfactory answer. I have now added one more test and I get an error which I do not understand. The two relevant tests are: def test_type_capitalsadvanced(self): self.assertEqual(type

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Sydney Shall
On 19/07/2017 17:43, Peter Otten wrote: Sydney Shall wrote: I am learning to use unittest. I have written a program that runs as it should. 247 tests give me a satisfactory answer. I have now added one more test and I get an error which I do not understand. The two relevant tests are

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Sydney Shall
On 19/07/2017 18:05, Alan Gauld via Tutor wrote: On 19/07/17 16:01, Sydney Shall wrote: I am learning to use unittest. def test_zero_in_capitalsadvanced(self): self.assertIn(self.capitalsadvanced, 0.0) Remember the interpreter... help(unittest.case.assertIn) Help on

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Sydney Shall
On 19/07/2017 18:42, Steven D'Aprano wrote: On Wed, Jul 19, 2017 at 05:01:53PM +0200, Sydney Shall wrote: [...] def test_zero_in_capitalsadvanced(self): self.assertIn(self.capitalsadvanced, 0.0) The error message is: Traceback (most recent call last): [...] in assertIn

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Sydney Shall
On 19/07/2017 18:56, Steven D'Aprano wrote: On Wed, Jul 19, 2017 at 06:08:57PM +0200, Sydney Shall wrote: (I haven't tested that code myself, so please try it, and if it doesn't work for some reason, let us know on the mailing list and somebody can fix it.) But... I'm r

Re: [Tutor] Does matplotlib.finance still work?

2017-08-25 Thread Sydney Shall
On 24/08/2017 18:46, Alan Gauld via Tutor wrote: On 24/08/17 14:51, C W wrote: I have the following code, I get an error at the first line. So don't make us guess. What is the error(full text please)? from matplotlib.finance import quotes_historical_yahoo_ochl And what does a dir() show f

Re: [Tutor] New Item

2017-10-15 Thread Sydney Shall
On 28/09/2017 11:46, Peter Otten wrote: larrystale...@comcast.net wrote: I am very new to Python and appreciate the input as I was able to fully install Python with all needed libraries (i.e., numpy, pandas, etc.). However, I now have an application question in needed to construct a 2D Histogra

Re: [Tutor] problem with a sub-class

2017-12-01 Thread Sydney Shall
On 30/11/2017 22:08, Alan Gauld via Tutor wrote: On 30/11/17 15:37, Shall, Sydney wrote: My problem is with constructing a sub-class. My sub-class is constructed as follows: import Population_ProductivityV24 as POCWP Note that POCWP is an alias for the *module* Population_ProductivityV24. I