Re: [Tutor] Decorators: Are they good for checking inputs and outputs?

2013-01-06 Thread Alan Gauld
On 06/01/13 12:30, DoanVietTrungAtGmail wrote: After much reading and head-scratching, I think the basic idea of decorators has now clicked for me. Congratulations. It's always good when a new concept finally slots in place. One thing - do you understand the downsides of decorators too? Every

Re: [Tutor] Decorators: Are they good for checking inputs and outputs?

2013-01-06 Thread Oscar Benjamin
On 6 January 2013 12:30, DoanVietTrungAtGmail wrote: > Dear tutors > > After much reading and head-scratching, I think the basic idea of decorators > has now clicked for me. I am a beginner in programming and in Python, but I > want to eventually develop a serious system. To spend most of my time

Re: [Tutor] Decorators: Are they good for checking inputs and outputs?

2013-01-06 Thread DoanVietTrungAtGmail
*.. Could you perhaps give a concrete example of a situation where a decorator would be useful for checking the inputs to a function? .. Oscar* Say I write a function that expects 5 positional arguments, and up to 4 ** arguments. Now I want to: a- check that the first positional argument is a sort

Re: [Tutor] Decorators: Are they good for checking inputs and outputs?

2013-01-06 Thread Oscar Benjamin
On 7 January 2013 00:13, DoanVietTrungAtGmail wrote: > .. Could you perhaps give a concrete example of a situation where a > decorator would be useful for checking the inputs to a function? .. Oscar > > Say I write a function that expects 5 positional arguments, and up to 4 ** > arguments. Now I w

Re: [Tutor] Decorators: Are they good for checking inputs and outputs?

2013-01-06 Thread Dave Angel
On 01/06/2013 07:13 PM, DoanVietTrungAtGmail wrote: > *.. Could you perhaps give a concrete example of a situation where > a decorator would be useful for checking the inputs to a function? .. Oscar* > > Say I write a function that expects 5 positional arguments, and up to 4 ** > arguments. Now I w

[Tutor] Here is code, no link for my previous question

2013-01-06 Thread Jack Little
Here is the code, my error is below the code in itallics   #This is not free source #Don't cheat by looking at this #If you do you ruin the game #A Towel Production # APOC #--- global ammo1 global ammo2 global ammo3 global health global tech_parts global exp global radio_parts ammo1=10 ammo2=0

Re: [Tutor] Here is code, no link for my previous question

2013-01-06 Thread Oscar Benjamin
On 7 January 2013 02:07, Jack Little wrote: > Here is the code, my error is below the code in itallics No explanation? > > #This is not free source > #Don't cheat by looking at this > #If you do you ruin the game I was a little concerned when I read this part. I guess it's okay for me to read o

Re: [Tutor] Here is code, no link for my previous question

2013-01-06 Thread Steven D'Aprano
On 07/01/13 13:07, Jack Little wrote: Here is the code, my error is below the code in itallics What italics? I see no italics. Please don't rely on so-called "rich text" email (italics, fancy fonts, different text sizes, etc), since it uses HTML code in your email and many people turn off suc

Re: [Tutor] Here is code, no link for my previous question

2013-01-06 Thread Steven D'Aprano
And a second reply: On 07/01/13 13:07, Jack Little wrote: def simpstart(): global ammo global health global tech_parts global radio_parts This function does nothing. It declares four globals, and then ends. All the subsequent lines of code are not indented, and so are not part of

Re: [Tutor] Here is code, no link for my previous question

2013-01-06 Thread Dave Angel
On 01/06/2013 09:07 PM, Jack Little wrote: > Here is the code, my error is below the code in itallics This is a text mailing list, italics aren't generally visible. If you want to highlight a line, add a useful comment to it. But the problem here is your scoping. All those globals make no sens

[Tutor] Documentation

2013-01-06 Thread Ed Owens
I have been working my way through Chun's book /Core Python Applications. /In chapter 9 he has a web crawler program that essentially copies all the files from a web site by finding and downloading the links on that domain. One of the classes has a procedure definition, and I'm having trouble

Re: [Tutor] Documentation

2013-01-06 Thread Alexander Mark
On Jan 6, 2013, at 22:48, Ed Owens wrote: > I have been working my way through Chun's book Core Python Applications. > > In chapter 9 he has a web crawler program that essentially copies all the > files from a web site by finding and downloading the links on that domain. > > One of the classes

Re: [Tutor] IronPython any tutors with experience out there?

2013-01-06 Thread Wayne Werner
On Thu, 3 Jan 2013, Bjorn Madsen wrote: Hello PythonTutor- I'm a scientist and very happy with python 2.7. I have been asked to assist a development program where everything is written in dotNET/ C# (visual studio 2012) and luckily Microsoft Visual Studio supports IronPython which is a clean P