A method defination , Python Programming

 

De?nition

 

A method de?nition has the abstract form:


def (, ..., ):

...

 

There are essentially three parts:

  • is a name for the procedure, with the similar limitation as a variable name;
  • , ..., is a list of formal arguments, which will given for the data elements on which this procedure will operate; and
  • , ..., , known as the body of the method, is a list of Python statements (right now, we know about assignment expression, print instruction.)

When we compute a procedure de?nition in an environment, E, Python does have two things:

 

1. Makes a procedure object19  that contains the formal parameters, the body of the function, and a pointer to E; and then

 

2. Binds the name  to have this procedure as its value.

 

Here is a program of an environment after we have calculated

 

 

1239_A method Defination.png

 

 

Note how  the construct to which  square points  is a procedure body, with  a number of formal  parameters,  a object, and a pointer to its environment.

 

Posted Date: 8/11/2012 2:00:29 AM | Location : United States







Related Discussions:- A method defination , Assignment Help, Ask Question on A method defination , Get Answer, Expert's Help, A method defination Discussions

Write discussion on A method defination
Your posts are moderated
Related Questions
Write an algorithm for the sum of the given series 1,-1/2,1/4,-1/8.....

from urllib2 import urlopen var= ('' response">http://placekitten.com'') response = kittens.read(body) body = response[559:1000] print ''Kittens:'', response

Procedures in Firrst-class objects In Python, unlike  many  other  languages, methods are behave in much  the same way as num­ bers:  they  can be stored as values  of variabl

#que Write a program that will take price data for stocks and print it graphically to the screen. Your program should begin by asking the user for the file name. It should then cre

For and While   If we want  to do some operation or set of operations various  times, we can handle the process  in several  different types.  The most straightforward types

#question.Program 10 Assignment (Banking Objects – Savings/Checking Accounts) Create a program named 10.py that performs the following: Create a class named ChkAcct, and a class n

List Comprehensions   Python has a very nice built-in  facility for doing  many  iterative methods, known as list comprehensions. The basic template is       [

Common Errors and Messages Here are some common Python errors  and error  messages to look  out for. Please let us give if you have any favorite additions for this list.

Basics of python-introduction Python is designed for easy interaction between a user and the system. It goes with  an inter­ active function  known as  a shell or listener.  T

When investing money, an important concept to know is compound interest. The equation FV = PV (1+rate)periods . This relates the following four quantities. The present value (