Re: [Tutor] methods vs. functions

2011-08-22 Thread Alan Gauld
On 23/08/11 00:10, Robert Sjoblom wrote: Can someone please explain the difference between methods and functions? I'm sure if you go to Wikipedia you will get the correct computer science distinctions, however in practical terms and limiting the discussion to Python: A function is a piece

Re: [Tutor] methods vs. functions

2011-08-22 Thread Robert Sjoblom
> Can someone please explain the difference between methods and functions? I've heard the explanation "A cow is an animal but an animal is not necessarily a cow." used to describe the difference between methods and functions (ie, all methods are functions, but not all functions are methods). Obviou

Re: [Tutor] methods vs. functions

2011-08-22 Thread Modulok
On 8/22/11, Prasad, Ramit wrote: > Steven D'Aprano wrote: >>(Methods are very similar to functions. At the most basic level, we can >>pretend that a method is just a function that comes stuck to something >>else. Don't worry about methods for now.) > > Can someone please explain the difference bet

Re: [Tutor] methods vs. functions

2011-08-22 Thread Wayne Werner
On Mon, Aug 22, 2011 at 3:11 PM, Prasad, Ramit wrote: > Steven D'Aprano wrote: > >(Methods are very similar to functions. At the most basic level, we can > >pretend that a method is just a function that comes stuck to something > >else. Don't worry about methods for now.) > > Can someone please ex

Re: [Tutor] methods vs. functions

2011-08-22 Thread TheIrda
Well, my understanding is that function are used in procedural programmming to make the code reusable, and to divide the bigger problem in a serie of smaller ones. Methods are used in OOP, and mainly are the actions taht objects can perform. Thay have a very similar syntax in python, but the conc

[Tutor] methods vs. functions

2011-08-22 Thread Prasad, Ramit
Steven D'Aprano wrote: >(Methods are very similar to functions. At the most basic level, we can >pretend that a method is just a function that comes stuck to something >else. Don't worry about methods for now.) Can someone please explain the difference between methods and functions? Thanks, Ra