Re: [Tutor] How to put my functions in an array

2005-01-01 Thread Danny Yoo
On Sat, 1 Jan 2005, Jacob S. wrote: > funct = {'Add Virt':addvirt,'Remove Virt':remvirt,'More > Stuff':more,"Extras":extra} > def addvirt(): > pass > def remvirt(): > pass > def more(): > pass Hi Jacob, Quick gotcha note: the definition of the 'funct' dictionary has to g

Re: [Tutor] O.T.

2005-01-01 Thread Danny Yoo
On Thu, 30 Dec 2004, Anna Ravenscroft wrote: > Anna Martelli Ravenscroft > 42, 2 children (13 and 11) live with their dad > Married this July to the martelli-bot (we read The Zen of Python at our > wedding!). We currently live in Bologna, Italy. Hi Anna, Congratulations! Say hi to Alex for m

Re: [Tutor] Parsing a block of XML text

2005-01-01 Thread Danny Yoo
On Fri, 31 Dec 2004, kumar s wrote: > http://www.python.org/doc/lib/dom-example.html > > Frankly it looked more complex. could I request you to explain your > pseudocode. It is confusing when you say call a function within another > function. Hi Kumar, A question, though: can you try to expla

Re: [Tutor] doctest

2005-01-01 Thread Patric Michael
> Also, anything I can do... Presently, since I'm running windows xp, I > would have to hunt for the command prompt and type in the command Click Start, click Run, type CMD, press Enter. Voila! :) Patric > > '"C:\python24\python.exe" "C:\documents and > settings\jacob\desktop\working python

Re: [Tutor] doctest

2005-01-01 Thread Jacob S.
I forgot to mention... When I explicitly define the variable __doc__ at the module level, it *does* recognize the module level docstring. > I think I'm losing my mind... > > Maybe it's because I go back to school the day after tomorrow? > The thing that helped the most was the -v parameter... > >

Re: [Tutor] doctest

2005-01-01 Thread Jacob S.
I think I'm losing my mind... Maybe it's because I go back to school the day after tomorrow? The thing that helped the most was the -v parameter... Even so, doctest doesn't seem to recognize the module level docstring. It will run the test inside the functions, but it says there isn't a test on t

Re: [Tutor] doctest

2005-01-01 Thread Kent Johnson
What docs are you looking at?? The module docs at http://docs.python.org/lib/module-doctest.html have a complete example of testing a module with a main function. Or you can use the code in my last post. Kent Jacob S. wrote: Hi. Okay, so I look at the documentation at it says (in my words):

[Tutor] doctest

2005-01-01 Thread Jacob S.
Hi. Okay, so I look at the documentation at it says (in my words): "First Class - DocTest -- Make a test object with such and such attributes that you can test. Second Class - i don't remember the name - Make Jacob look stupid with big words Third Class - DocTestSuite - Convert a doctest obje

Re: [Tutor] *args, **kwargs

2005-01-01 Thread Alan Gauld
> class SomethingLikeThis: > def __init__(self, **kwargs): > self.kwargs = kwargs > > def show(self): > for k in self.kwargs.keys(): > v = selfkwargs.get(k) is this a typo in the mail or a real error? v = self.kwargs.get(k) > print v >

Re: [Tutor] How to substitute an element of a list as apattern forre.compile()

2005-01-01 Thread Jacob S.
> Actually %s formatting is very flexible and forgiving, it outputs str(x) whatever x is. For example: > >>> for x in ['string', 10, True, [1,2,3] ]: > ... print '%s' %x > ... > string > 10 > True > [1, 2, 3] > > Kent That's cool! I didn't know that. I guess I'm crazy... : ) (We already

Re: [Tutor] *args, **kwargs

2005-01-01 Thread Kent Johnson
You seem to be on the right track Luis N wrote: I'm wondering how I can turn a variable number of keyword arguments passed to a class into variables for use in said class: #This so doesn't work It is helpful if you tell us what you tried and how it failed... class SomethingLikeThis: def __init_

Re: [Tutor] How to substitute an element of a list as a pattern forre.compile()

2005-01-01 Thread Kent Johnson
Jacob S. wrote: Rich needs to make the % formatting "%d"%x instead of "%s"%x because he showed that x is an integer not a string. Actually %s formatting is very flexible and forgiving, it outputs str(x) whatever x is. For example: >>> for x in ['string', 10, True, [1,2,3] ]: ... print '%s'

Re: [Tutor] Help with testing.

2005-01-01 Thread Kent Johnson
Jacob, The module is doctest, if you look at the docs you will see examples of how to use it. I'm not sure if there is a way to run the doctests for a single function - the doctest functions seem to be oriented toward testing entire modules. To test a module selected by user input, you could do

[Tutor] *args, **kwargs

2005-01-01 Thread Luis N
Hi, I gave this a quick read: http://aspn.activestate.com/ASPN/Mail/Message/573292 I'm wondering how I can turn a variable number of keyword arguments passed to a class into variables for use in said class: #This so doesn't work class SomethingLikeThis: def __init__(self, **kwargs):

Re: [Tutor] How to substitute an element of a list as a pattern forre.compile()

2005-01-01 Thread Jacob S.
Nobody explicitly mentioned that you're trying to make a pattern from an integer and not a string, which, I believe is required. Also, Rich needs to make the % formatting "%d"%x instead of "%s"%x because he showed that x is an integer not a string. There's my two bits. Jacob Schmidt > Hi Gro

Re: [Tutor] How to put my functions in an array

2005-01-01 Thread Jacob S.
Hello. I believe it was Danny Yoo who told me about mapping functions a while back on the list... It goes along these lines... funct = {'Add Virt':addvirt,'Remove Virt':remvirt,'More Stuff':more,"Extras":extra} def addvirt(): pass def remvirt(): pass def more(): pass def extra():

[Tutor] Help with testing.

2005-01-01 Thread Jacob S.
Hi, A little while back somebody suggested doctesting, I think it was. Well, anyway, it was the testing that took testing material from the doc strings of functions in the format of an interpreter and the desired result (example below). Could anyone help by pointing me to structured documentat

Re: [Tutor] O.T.

2005-01-01 Thread Jacob S.
> In love with computers and programming since forever (well, maybe only since 1968 or so...) > Working as a professional programmer mostly since 1977. Languages I have actually been paid to > program in include It seems like forever to someone who hasn't seen before 1990. : ) > Python is a lot of

[Tutor] Using £ in python

2005-01-01 Thread David Holland
Kent, When I tried '\xc2' nothing happened. I should have said that is a game using pygame. Kent --- [EMAIL PROTECTED] wrote: > Send Tutor mailing list submissions to > tutor@python.org > > To subscribe or unsubscribe via the World Wide Web, > visit > http://mail.python.org/mailman