About

Swaroop C H is 27 years of age. He is currently a Product Leader at Infibeam, one of the largest ecommerce companies in India. He has previously worked at Yahoo!, Adobe and his own startup.

Read more about him

Page
Personal tools
COLLECTION
Collection

Talk:Python en:Functions

From Notes

Jump to: navigation, search

I saw your todo, and I think it would be more pedagogical if you put the section about VarArgs in a later chapter, and everything else that is related to stuff that we haven't learned. I think the most important thing about this book is that it teaches you things step by step, and putting something that is too advanced there will have people confused.

In short: You have my support.

I disagree. I think it needs to be made clearer that this information is advanced enough that it can be skipped over until the chapter that the information is needed on. Then link back, or duplicate the text. I say this because this seems to be the logical place for this information.
However, I can't read the code. I can't back track to find out what += means. I'm fairly sure it mean increase by a unit, but I'm not sure because += and -= have not been mentioned before this point. This is frustrating. Thanks for the book, btw

[edit] ==

In the part saying: "/1/All variables have the scope of the block they are declared in /2/starting from the point of definition of the name."

it seems to me that the second half is just restating what the first half already said, I'm not exactly sure that this is the case though. I hope someone with better understanding of what is trying to be said here can clarify the situation.

(And sorry for the messy way I'm editing this talk page, I promise to learn how to do it more cleanly if someone can point me to info on how to use this wiki...)

It means that you cannot use the name before actually assigning it some value, which is a reasonably common mistake. -- Swaroop 18:00, 17 September 2009 (UTC)

[edit] Function Parameters

When you're describing the terminology for function's parameters, you make it a point to distinguish between parameters and arguments; however, after trying to wrap my head around them, it seems that python's documentation doesn't differentiate the two. In the official doc's it states "The actual parameters (arguments) to a function call are introduced in the local symbol table of the called function when it is called", implying they are used interchangeably (favoring 'arguments').

I asked the difference on the freenode #python channel in irc, and they said there was none, but in python, 'argument' is more often used. Since I'm reading your tutorial I'm an obvious noob so correct me if I'm wrong, but if it's an error it could throw other noobs for a loop.

It may not make a difference in python terminology, but makes it much easier to explain that they are two different concepts and the names can be different. For example, a newbie shouldn't mistake that calling `func(x, y)` means the function definition must have `def func(x, y)` and so on. It was for pedagogical purpose. -- Swaroop 20:18, 12 August 2010 (UTC)
Thank you for the explanation; on second thought, this makes a lot of sense and should be distinguished in python itself. Great book.