Re: [Tutor] Modules and Python tutorial by S. Thurlow - opinions please

2011-08-21 Thread Lisi
On Saturday 20 August 2011 23:53:53 Alan Gauld wrote: > On 20/08/11 15:25, Lisi wrote: > > ridiculous. I think that I understand how to write a basic function, but > > I can't work out how to save and call it. [snip] > There is a full worked example in the Functions and Modules > topic in my tutor

[Tutor] Where is sys.py?

2011-08-21 Thread Lisi
If sys.py is a file, it must be somewhere; but I can't find it. Where is it? I would like to look at it. The modules within it must surely be somewhere too. But since I can't find sys, I obviously can't find the modules. Again, I'd like to look at them. In case it is relevant, I am using Py

Re: [Tutor] Where is sys.py?

2011-08-21 Thread R. Berman
> -Original Message- > From: tutor-bounces+bermanrl=cfl.rr@python.org [mailto:tutor- > bounces+bermanrl=cfl.rr@python.org] On Behalf Of Lisi > Sent: Sunday, August 21, 2011 7:58 AM > To: tutor@python.org > Subject: [Tutor] Where is sys.py? > > If sys.py is a file, it must be some

Re: [Tutor] Where is sys.py?

2011-08-21 Thread Peter Otten
Lisi wrote: > If sys.py is a file, it must be somewhere; but I can't find it. Where is > it? I would like to look at it. You are out of luck, there is no sys.py. The sys module is so tightly integrated that Python cannot run without it; it has to be part of the interpreter and is written in C.

Re: [Tutor] Where is sys.py?

2011-08-21 Thread xDog Walker
On Sunday 2011 August 21 04:57, Lisi wrote: > If sys.py is a file, it must be somewhere; but I can't find it. Where is > it? I would like to look at it. > > The modules within it must surely be somewhere too. But since I can't find > sys, I obviously can't find the modules. Again, I'd like to lo

Re: [Tutor] Where is sys.py?

2011-08-21 Thread Lisi
On Sunday 21 August 2011 12:57:50 Lisi wrote: > If sys.py is a file, it must be somewhere; but I can't find it. Where is > it? I would like to look at it. > > The modules within it must surely be somewhere too. But since I can't find > sys, I obviously can't find the modules. Again, I'd like to

Re: [Tutor] Where is sys.py?

2011-08-21 Thread Emile van Sebille
On 8/21/2011 4:57 AM Lisi said... If sys.py is a file, it must be somewhere; but I can't find it. Where is it? I would like to look at it. The modules within it must surely be somewhere too. But since I can't find sys, I obviously can't find the modules. Again, I'd like to look at them. In c

[Tutor] Coin Flipping Program

2011-08-21 Thread Joel Preston
Hello Programmers, I am trying to learn Python on my own through a book called "Python Programming for the Absolute Beginner". I am stuck on a challenge at the end of a chapter and I am hoping for a little help. The challenge is to write a program that flips a coin 100 times and tells you the nu

Re: [Tutor] Coin Flipping Program

2011-08-21 Thread xDog Walker
On Sunday 2011 August 21 09:14, Joel Preston wrote: > Hello Programmers, > > I am trying to learn Python on my own through a book called "Python > Programming for the Absolute Beginner". I am stuck on a challenge at the > end of a chapter and I am hoping for a little help. > > The challenge is to

[Tutor] How have I transgressed??

2011-08-21 Thread Lisi
I have just received the following.* In what way have I transgressed? I apologise to you all - but as I mentioned, I had been stuck for weeks and am running out of time. And I certainly tried to help myself - I just didn't succeed! Anyhow, if someone will tell me in what way I have transgress

[Tutor] Store the output of os.system

2011-08-21 Thread ANKUR AGGARWAL
Hey I am executing a grep command in my python program using os.system. I want to store the output somewhere but because of GUI's involved (generated using tkinter and pyzenity) I am unable to store my output or the result of the executed grep command in some form. Can you guys tell me how to store

Re: [Tutor] How have I transgressed??

2011-08-21 Thread Emile van Sebille
On 8/21/2011 10:08 AM Lisi said... I have just received the following.* In what way have I transgressed? I apologise to you all - but as I mentioned, I had been stuck for weeks and am running out of time. And I certainly tried to help myself - I just didn't succeed! Anyhow, if someone will tel

Re: [Tutor] Coin Flipping Program

2011-08-21 Thread Alan Gauld
On 21/08/11 17:14, Joel Preston wrote: tells you the number of heads and tails that come up. So far I can write a program that will flip a coin 100 times but it will only come up tails or heads all 100 times. Look again at your code, you only assign a value to coin once, before you enter the

Re: [Tutor] Store the output of os.system

2011-08-21 Thread Emile van Sebille
On 8/21/2011 10:15 AM ANKUR AGGARWAL said... Hey I am executing a grep command in my python program using os.system. I want to store the output somewhere but because of GUI's involved (generated using tkinter and pyzenity) I am unable to store my output or the result of the executed grep command

Re: [Tutor] How have I transgressed??

2011-08-21 Thread Lisi
Thanks for the reply, Emile. :-) On Sunday 21 August 2011 18:25:44 Emile van Sebille wrote: > The sender's email address is verified and those 'new to the list' get > this message -- do you have multiple email accounts Yes - but I consistently use the same one for this list, and have checked my

Re: [Tutor] Coin Flipping Program

2011-08-21 Thread delegbede
Hi Joel, Someone has asked this question before and I think it was dealt with. That said, in my opinion, starting out with python 3 reduces the number of assist you can get on the fly. I for one have dealt with this issue before but can't help with the python 3 areas. Have you checked Ala

Re: [Tutor] How have I transgressed??

2011-08-21 Thread Andre Engels
On Sun, Aug 21, 2011 at 7:25 PM, Emile van Sebille wrote: > On 8/21/2011 10:08 AM Lisi said... > > I have just received the following.* In what way have I transgressed? I >> apologise to you all - but as I mentioned, I had been stuck for weeks and >> am >> running out of time. And I certainly

Re: [Tutor] How have I transgressed??

2011-08-21 Thread Luke Paireepinart
Same here as Andre said. I've gotten that email probably a dozen times by now. It's based on an amount of absence I believe. - Sent from a mobile device. Apologies for brevity and top-posting. - On Aug 21, 2011, at 2:37 PM, Andre Engels wr

Re: [Tutor] Store the output of os.system

2011-08-21 Thread Alan Gauld
On 21/08/11 18:15, ANKUR AGGARWAL wrote: Hey I am executing a grep command in my python program using os.system. I guess the first question is why? Python's re module can do pretty much anything that grep can do and do it inside your program with no extra processes being started. Why not just

[Tutor] Please explain TypeError

2011-08-21 Thread D. Guandalino
Python documentation says: > exception TypeError > > Raised when an operation or function is applied to an object of > inappropriate type. The associated value is a string giving details > about the type mismatch. For example: >>> 'foo' + (1, 2) Traceback (most recent call last): File "", line

[Tutor] Please help understanding unittest fixtures

2011-08-21 Thread D. Guandalino
Suppose I have this TestCase class. class C(TestCase): def setUp(): # very time consuming and resources intensive stuffs. pass def test_A(self): pass def test_B(self): pass def test_C(self): pass The unittest docs says: > Each instance of the TestCas

Re: [Tutor] Please explain TypeError

2011-08-21 Thread Dave Angel
On 08/21/2011 05:35 PM, D. Guandalino wrote: Python documentation says: exception TypeError Raised when an operation or function is applied to an object of inappropriate type. The associated value is a string giving details about the type mismatch. For example: 'foo' + (1, 2) Traceback (mo

Re: [Tutor] Please explain TypeError

2011-08-21 Thread D. Guandalino
On 22 August 2011 00:17, Dave Angel wrote: > On 08/21/2011 05:35 PM, D. Guandalino wrote: > >> Python documentation says: >> >> exception TypeError >>> >>> Raised when an operation or function is applied to an object of >>> inappropriate type. The associated value is a string giving details >>>

Re: [Tutor] Please explain TypeError

2011-08-21 Thread Walter Prins
On 21 August 2011 22:35, D. Guandalino wrote: > >>> class C(object): > ... def __init__(self): > ... pass > ... > >>> C(1) > Traceback (most recent call last): > File "", line 1, in > TypeError: __init__() takes exactly 1 argument (2 given) > > I'm having hard times understandin

Re: [Tutor] How have I transgressed??

2011-08-21 Thread Steven D'Aprano
Lisi wrote: I have just received the following.* In what way have I transgressed? I apologise to you all - but as I mentioned, I had been stuck for weeks and am running out of time. And I certainly tried to help myself - I just didn't succeed! Anyhow, if someone will tell me in what way I ha

Re: [Tutor] Where is sys.py?

2011-08-21 Thread Steven D'Aprano
Lisi wrote: If sys.py is a file, it must be somewhere; but I can't find it. Where is it? I would like to look at it. Others have already answered this, but consider how you might explore the answer at the interactive interpreter: >>> import os >>> os.__file__ '/usr/lib/python2.5/os.pyc' >>

Re: [Tutor] Please help understanding unittest fixtures

2011-08-21 Thread Steven D'Aprano
D. Guandalino wrote: Suppose I have this TestCase class. class C(TestCase): def setUp(): # very time consuming and resources intensive stuffs. pass def test_A(self): pass def test_B(self): pass def test_C(self): pass The unittest docs says: Each i

Re: [Tutor] Please explain TypeError

2011-08-21 Thread Steven D'Aprano
D. Guandalino wrote: class C(object): ... def __init__(self): ... pass ... C(1) Traceback (most recent call last): File "", line 1, in TypeError: __init__() takes exactly 1 argument (2 given) I'm having hard times understanding why a TypeError is raised here. Could you exp