Re: [Tutor] console text positioning

2005-11-13 Thread Alan Gauld
> ANSI is the standard for terminal control, so I usually code for > that, but put it in a separate module so that other terminals can > easily be accommodated. It certainly used to be under MS DOS but I find very few windows machines set up to use ANSI codes. Do you know any way t

Re: [Tutor] Symbolic maths In Python

2005-11-13 Thread Matt Williams
I don't know if this will do anywhere near what you want... http://swiginac.berlios.de/ is a set of Python bindings to GiNaC, which handles symbolic maths in C/C++. Matt ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/t

Re: [Tutor] problem calling a function

2005-11-13 Thread Roel Schroeven
Vincent Wan wrote: > Dear all, > > I have a simple program that calls a function I got off of active > state that draws > a tree given a description of it in standard string form. > > My code generates a string description and calls the function to draw > the tree. > Instead of drawing the tr

Re: [Tutor] Seeking PYTHON Mentor

2005-11-13 Thread Kent Johnson
mike donato wrote: > I believe in academic honesty and so I am not inclining to cheating just > seeking support for the given language so I may develop the fundamental > skills to work thru the excercises. > > Any assistance which can be provided will be greatly appreciated. Ask questions here

Re: [Tutor] problem calling a function

2005-11-13 Thread Roel Schroeven
Roel Schroeven wrote: > > You'll have to modify your code so that it creates a tuple instead of a > string. It seems that doing it without using a string complicates matters, or at least increases the line count. I tried it with a list, since you can't build a tuple on the go since tuples are imm

Re: [Tutor] Seeking PYTHON Mentor

2005-11-13 Thread Alan Gauld
Hi Mike, > Greetings, I am an Information Technology student and am seeking a mentor > for the Python Language. Treat this mailing list as a virtual mentor. We will take questions either theoretical, conceptual or practical. Tell us what you need help with, tell us what you've done to try to so

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
* Kent Johnson <[EMAIL PROTECTED]> [051112 20:33]: > Tim Johnson wrote: > >I need to get up to speed on iterators. I learned python 1.5~ via > >Alan G's book ... > >For an example, I've written a subclass of dict where keys are kept in > >a ordered fashion is a list called __keys: > > > >#Here is m

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Kent Johnson
Tim Johnson wrote: > Question: Can one subclass an iterator object? > thanks for making this a little clearer. Most *classes* can be subclassed. What do you have in mind? -- http://www.kentsjohnson.com ___ Tutor maillist - Tutor@python.org http:

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread John Fouhy
On 14/11/05, Tim Johnson <[EMAIL PROTECTED]> wrote: > Now if I assign a value to the iteritems method, as in > it = s.iteritems() > I get an object of > and dir(it) shows that (it) has one public method - next(). Yep. The normal way to use an iterator is in a for loop. So, if you've don

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
* John Fouhy <[EMAIL PROTECTED]> [051113 12:16]: > On 14/11/05, Tim Johnson <[EMAIL PROTECTED]> wrote: > > Now if I assign a value to the iteritems method, as in > > it = s.iteritems() > > I get an object of > > and dir(it) shows that (it) has one public method - next(). > > Yep. The nor

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
* Kent Johnson <[EMAIL PROTECTED]> [051113 12:04]: > Tim Johnson wrote: > > Question: Can one subclass an iterator object? > > thanks for making this a little clearer. > > Most *classes* can be subclassed. What do you have in mind? Oh, I'm just playing right now but what is the iter

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Liam Clarke-Hutchinson
Someone correct me if I'm wrong, but I believe there is no specific iterator object, but rather objects that have a method for __iter___... Liam Clarke-Hutchinson -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Johnson Sent: Monday, 14 November 2005 1

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
* Liam Clarke-Hutchinson <[EMAIL PROTECTED]> [051113 12:41]: > Someone correct me if I'm wrong, but I believe there is no specific iterator > object, but rather objects that have a method for __iter___... Some light is slowly dawning here (I think) from http://docs.python.org/ref/yield.

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Kent Johnson
Tim Johnson wrote: > * Liam Clarke-Hutchinson <[EMAIL PROTECTED]> [051113 12:41]: > >>Someone correct me if I'm wrong, but I believe there is no specific iterator >>object, but rather objects that have a method for __iter___... > > > Some light is slowly dawning here (I think) from >

Re: [Tutor] iteritems() vs items()

2005-11-13 Thread Tim Johnson
Well put. Got it. Thanks Kent tj * Kent Johnson <[EMAIL PROTECTED]> [051113 14:44]: > Tim Johnson wrote: > > * Liam Clarke-Hutchinson <[EMAIL PROTECTED]> [051113 12:41]: > > > >>Someone correct me if I'm wrong, but I believe there is no specific iterator > >>object, but rather objects that have a

[Tutor] Converting a List/Tuple to delimited string

2005-11-13 Thread Roy Bleasdale
I have a list of strings and wanted to output them as a single delimited string. Eg ('ab','cd','ef') becomes "ab:cd:ef" My first attempt was to do it as a function: def Addsomething(a): y = [] for x in a: y.append( x + ':') return "".join(y) I then conv

Re: [Tutor] Converting a List/Tuple to delimited string

2005-11-13 Thread John Fouhy
On 14/11/05, Roy Bleasdale <[EMAIL PROTECTED]> wrote: > I have a list of strings and wanted to output them as a single delimited > string. > > Eg > > ('ab','cd','ef') becomes "ab:cd:ef" You almost had it ... What about: >>> lst = ['ab', 'cd', 'ef'] >>> ':'.join(lst) 'ab:cd:ef' In general, foo.j

[Tutor] problem calling a function

2005-11-13 Thread Vincent Wan
Thank you Roel Schroeven I don't know how I missed the fact that the printDendrogram function needs tuples not strings. I didn't recognize that my string was a tuple so I didn't realize that when I pasted it interactively in IDEL I was allowing python to change the type. eval() changes the ty

[Tutor] Looking for suggestions

2005-11-13 Thread ->Terry<-
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I have written a small peg game using Pygame. This is the first working version. I have a request and a couple of perhaps silly questions. To anyone willing to take the time to have a look at the code and offer any advice or suggestions, I would be m

[Tutor] Another Quick Question

2005-11-13 Thread Steve Haley
Folks,   I’m one of the people new to Python who has started going through a beginner’s book to learn the basics of the language (“Python Programming for the Absolute Beginner”).  In the second chapter the author (Michael Dawson) illustrates the use of escape sequences with, among other t

Re: [Tutor] problem calling a function

2005-11-13 Thread Danny Yoo
> eval() changes the type from string to tuple. But, to my surprise > tuple() does not yeild the tuple that is represented by the string but a > tuple representation of the string. > > If eval() does convert correctly why not use it? The string will always > be a valid tuple. Hi Vincent, Altern

Re: [Tutor] Another Quick Question

2005-11-13 Thread Johan Geldenhuys
Could this be a OS thing? I use Linux and it works here. Steve Haley wrote: Folks,   I’m one of the people new to Python who has started going through a beginner’s book to learn the basics of the language (“Python Programming for the Absolute Beginner”).  In the second chapt

Re: [Tutor] Another Quick Question

2005-11-13 Thread Pujo Aji
I use windows, it works for meHave checked your sound card, volume before trying the code?pujoOn 11/14/05, Johan Geldenhuys < [EMAIL PROTECTED]> wrote: Could this be a OS thing? I use Linux and it works here. Steve Haley wrote: Folks,   I'm one of the people new to