[Tutor] Str Method

2012-11-01 Thread Ashley Fowler
Hello I am trying to add a str method to a Set ADT implementation to allow a user to print the contents of a set. However the resulting string should look like that of a list. except I am suppose to use curly brackets to surround the elements. For an example... set1 = Set() print(set1) {}

Re: [Tutor] Str Method

2012-11-01 Thread Alan Gauld
On 01/11/12 15:34, Ashley Fowler wrote: Hello I am trying to add a str method to a Set ADT implementation to allow a user to print the contents of a set. However the resulting string should look like that of a list. except I am suppose to use curly brackets to surround the elements. For an

Re: [Tutor] Str Method

2012-11-01 Thread bob gailer
On 11/1/2012 11:34 AM, Ashley Fowler wrote: Hello I am trying to add a str method to a Set ADT implementation to allow a user to print the contents of a set. However the resulting string should look like that of a list. except I am suppose to use curly brackets to surround the elements. For

Re: [Tutor] Str Method

2012-11-01 Thread Mark Lawrence
On 01/11/2012 15:34, Ashley Fowler wrote: Hello I am trying to add a str method to a Set ADT implementation to allow a user to print the contents of a set. However the resulting string should look like that of a list. except I am suppose to use curly brackets to surround the elements. For an

[Tutor] need help

2012-11-01 Thread Matthew Ngaha
working through my tutorial ive been told to set up a simple webserver. i can't even get started because the 1st line of code its asked me to do fails with a syntax error. here's the code: python3 -m http.server any ideas what is going wrong? it asked me to make some simple .html files, then in

Re: [Tutor] need help

2012-11-01 Thread Alex Clark
On 2012-11-01 21:24:52 +, Matthew Ngaha said: working through my tutorial ive been told to set up a simple webserver. i can't even get started because the 1st line of code its asked me to do fails with a syntax error. here's the code:   python3 -m http.server   any ideas what is going

Re: [Tutor] need help

2012-11-01 Thread Dave Angel
On 11/01/2012 05:24 PM, Matthew Ngaha wrote: working through my tutorial ive been told to set up a simple webserver. i can't even get started because the 1st line of code its asked me to do fails with a syntax error. here's the code: If you got an error, quote it in full in your message (using

Re: [Tutor] need help

2012-11-01 Thread Matthew Ngaha
Always, *always* include the *full* error message, otherwise we have to guess. Not fun. Some other questions: What operating system are you using? What version of Python does your tutorial assume? Do you in fact have Python 3 installed on your system? maybe im running it from the

Re: [Tutor] need help

2012-11-01 Thread Matthew Ngaha
Works for me with 3.3: aclark@Alexs-MacBook-Pro:~/ python3.3 -m http.server Serving HTTP on 0.0.0.0 port 8000 ... hey how do you start it or where do you run it from. did you type that in the command line? ___ Tutor maillist -

Re: [Tutor] Str Method

2012-11-01 Thread eryksun
On Thu, Nov 1, 2012 at 4:12 PM, bob gailer bgai...@gmail.com wrote: Why not create theElements as a set to start with? what is Set ADT? is it important that we know that? I suppose it's an implementation of the set abstract data type (i.e. operations such as add, union, difference):

Re: [Tutor] need help

2012-11-01 Thread Dave Angel
On 11/01/2012 05:47 PM, Matthew Ngaha wrote: Always, *always* include the *full* error message, otherwise we have to guess. Not fun. Some other questions: What operating system are you using? What version of Python does your tutorial assume? Do you in fact have Python 3 installed on your

Re: [Tutor] need help

2012-11-01 Thread Matthew Ngaha
If you got an error, quote it in full in your message (using copy/paste, not by retyping or paraphrasing. As it stands, we don't know if the error was in bash, in csh, in cmd, or in Python, and if it was in python, we don''t know what version. python3 -m http.server Where did you type

Re: [Tutor] need help

2012-11-01 Thread Dave Angel
On 11/01/2012 05:55 PM, Matthew Ngaha wrote: If you got an error, quote it in full in your message (using copy/paste, not by retyping or paraphrasing. As it stands, we don't know if the error was in bash, in csh, in cmd, or in Python, and if it was in python, we don''t know what version.

Re: [Tutor] need help

2012-11-01 Thread Matthew Ngaha
Don't run it from inside IDLE. You were right to run it from cmd. Pasting the error message you showed elsewhere: 'python3' is not recognized as an internal or external command, operable program or batch file. That simply says that the PATH does not point to your PYTHON3.bat or

Re: [Tutor] need help

2012-11-01 Thread eryksun
On Thu, Nov 1, 2012 at 5:55 PM, Matthew Ngaha chigga...@gmail.com wrote: i type it in both IDLE and CMD. in the directory where i made those .html files, i held shift and right clicked to get the command line open. im on windows vista. the i type that line in there. i use Python 3.1 The

Re: [Tutor] need help

2012-11-01 Thread Matthew Ngaha
The interpreter executable in Windows is always called python (console) or pythonw (no console). The 3.1 installer doesn't put the executable's directory on the system PATH. The option to add this was added to the 3.3 installer. Otherwise you'll have to add the directory manually. In IDLE

Re: [Tutor] need help

2012-11-01 Thread eryksun
On Thu, Nov 1, 2012 at 6:37 PM, Matthew Ngaha chigga...@gmail.com wrote: import sys sys.executable 'D:\\Data\\Program Files Data\\Py\\pythonw.exe' i dont see Python31 .. is this Py that is supposed to be Python31?.. and do i type this exactly like you did in cmd? set

Re: [Tutor] need help

2012-11-01 Thread Matthew Ngaha
No, in your case it's set PATH=%PATH%;D:\Data\Program Files Data\Py That's just a temporary modification for the current cmd process. It's easiest to show how to change it permanently with screen captures; search for vista set path. i followed the instructions at

Re: [Tutor] need help

2012-11-01 Thread eryksun
On Thu, Nov 1, 2012 at 7:12 PM, Matthew Ngaha chigga...@gmail.com wrote: No, in your case it's set PATH=%PATH%;D:\Data\Program Files Data\Py That's just a temporary modification for the current cmd process. It's easiest to show how to change it permanently with screen captures; search

Re: [Tutor] need help

2012-11-01 Thread Matthew Ngaha
Py is a directory. Once you've added the Python executable's directory to the path, you can start the http.server module as a script by running the following: python -m http.server Don't use pythonw in this case. The latter is associated with the .pyw file extension, used for scripts

Re: [Tutor] Str Method

2012-11-01 Thread Steven D'Aprano
On 02/11/12 02:34, Ashley Fowler wrote: Question is how do you implement the curly brackets in my str method? This is what I have so far... def __init__( self, *initElements ): self._theElements = list() def __str__(self): return self._theElements __str__ should return a

Re: [Tutor] Str Method

2012-11-01 Thread eryksun
On Thu, Nov 1, 2012 at 8:19 PM, Steven D'Aprano st...@pearwood.info wrote: s = str(self._theElements) s = s.replace([, {).replace(], }) return s Another way is to build the string yourself: s = ', '.join(str(item) for item in self._theElements) return '{' + s + '}'

[Tutor] Tutor needed!

2012-11-01 Thread Jarred Lavier
Looking for someone who can walk me through certain homework assignments, as well as explaining how to create them. If interested please e-mail me as soon as possible. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription