[Tutor] Beer Bottles

2006-07-06 Thread Steve Nelson
A bunch of my friends and I have been chatting about "99 bottles of beer" - and how to make the shortest code to do it. I have: for i in range(100,0,-1): print "%s bottles of beer on the wall, %s bottles of beer\nTake on down, pass it around.."%(i,i) print "Go to the store, buy some more" I'm

[Tutor] Test

2006-07-06 Thread Steve Nelson
I got a bounce... but have been on this list for months... S. ___ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Beer Bottles

2006-07-06 Thread Luke Paireepinart
Steve Nelson wrote: > A bunch of my friends and I have been chatting about "99 bottles of > beer" - and how to make the shortest code to do it. I have: > > for i in range(100,0,-1): >print "%s bottles of beer on the wall, %s bottles of beer\nTake on > down, pass it around.."%(i,i) > print "Go

Re: [Tutor] time(duration) formats & basic time math query

2006-07-06 Thread Kent Johnson
kevin parks wrote: > I have been handed a huge number of documents which have hundreds of > pages of times and durations, all calculated and notated by several > different people over the course of many years. Sadly, no made any > guidelines at all about how this work would proceed and all th

[Tutor] trace the changes

2006-07-06 Thread linda.s
I am reading a long python code with many if...then; I wonder whether there is any way to trace the changes of the variables in the code. I can not find debugger tutorial in detail in PythonWin. Thanks for any suggestions. Linda ___ Tutor maillist - Tut

Re: [Tutor] what %s=%s means?

2006-07-06 Thread Alan Gauld
>I really new to python.I try on learning it by code examples.The > following one from "Dive into python": If you know another language then the official tutorial is the best place to start, it explains all of the items on your question list. Dive into Python is very good but it is really intende

[Tutor] the lambda func

2006-07-06 Thread devayani barve
Hi, I have just started learning python... Following is an example from dive into python:   def info(object,spacing=10,collapse=1):    """Print methods and doc strings.    Takes module,class,list,dictionary or string."""    methodList=[method for method in dir(object) if callable(getattr(object,met

Re: [Tutor] time(duration) formats & basic time math query

2006-07-06 Thread Alan Gauld
> So the input doc would be grepped for times and i could just > uncomment the line i need and get he format my boss wants at this > particular moment. You shouldn't need to uncomment it if you can specify an argument that describes which format you want. Then have a bunch of formatting func

Re: [Tutor] Beer Bottles

2006-07-06 Thread Alan Gauld
> for i in range(100,0,-1): > print > print "Go to the store, buy some more" > > I'm curious to know other ways to handle this - could it be done > functionally? How could we obfuscate this (not that we'd want to in > real life)? Or make it a (close to) one liner? print "".join(['%s bottles of

[Tutor] Functional Programming

2006-07-06 Thread Steve Nelson
Hi All, I've just today starting thinking more about programming in a more functional style, and came across the following article which I thought was really good: http://www.amk.ca/python/writing/functional I know there's a section in Alan's tutorial on FP too, but can anyone else recommend som

Re: [Tutor] Functional Programming

2006-07-06 Thread Danny Yoo
On Thu, 6 Jul 2006, Steve Nelson wrote: > I've just today starting thinking more about programming in a more > functional style, and came across the following article which I thought > was really good: > > http://www.amk.ca/python/writing/functional Hi Steve, The references on the bottom are

Re: [Tutor] Functional Programming

2006-07-06 Thread Kent Johnson
Steve Nelson wrote: > Hi All, > > I've just today starting thinking more about programming in a more > functional style, and came across the following article which I > thought was really good: > > http://www.amk.ca/python/writing/functional > > I know there's a section in Alan's tutorial on FP

Re: [Tutor] Beer Bottles

2006-07-06 Thread Terry Carroll
On Thu, 6 Jul 2006, Alan Gauld wrote: > Not very obfuscated though... For *true* obfuscation, nothing matches perl: cut here -- ''=~('(?{'.('`'|'%').('['^'-') .('`'|'!')

Re: [Tutor] Functional Programming

2006-07-06 Thread Terry Carroll
On Thu, 6 Jul 2006, Steve Nelson wrote: > I know there's a section in Alan's tutorial on FP too, but can anyone > else recommend some good references? I happened upon this column a few days ago, whic I found a good read to explain the basic idea, for non-FPers like me: http://www.defmacro.org

Re: [Tutor] Functional Programming

2006-07-06 Thread Michael
On Friday 07 July 2006 00:39, Terry Carroll wrote: > Neither of these is particularly directed to Python, though. Also, much as I like python, it's not really suited to functional programming approaches, given recursion isn't tail optimised, lambda is by comparison crippled, some aspects of python