forked from chavarera/PythonScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4.CreateAndFetchDocuments.py
More file actions
60 lines (43 loc) · 1.6 KB
/
4.CreateAndFetchDocuments.py
File metadata and controls
60 lines (43 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#To write simple Document inside a program
#we can write document using '''document or help add here''' inside
#1.class
#2.Normal Function
#3.Methods
#To fetch the our written code document we have two different method to collect documents
#1.__doc__
#2.help() function
#1.__doc__
#Doc string is used to get detail information about code
#Simple syntax of __doc__ for class is : Classname.__doc__
# __doc__ for class method:Classname.methodname.__doc__
# __doc__ for simple normal function:FunctionName.__doc__
#2.help() function
#help() function is used to retrive all document related to class unctions and method
#we can simple define help as :help(any class,function object)
#help give all document about
#1.about class and
#2.defined method inside of class
#3.dictionaries
def CustomFunction():
'''I am a simple custom function'''#document about function
print('i am from custom function')
class Circle():
'''this is Circle Class used to find out area''' #Add Document About Class here
def __init__(self,radious,pi):
self.radious=radious
self.pi=pi
def area(self):
'''this is area method inside Circle ''' #document inside a method
return self.pi*self.radious**2
circle1=Circle(3,3.14)
print(circle1.area())
#TO print out Class Document
print(Circle.__doc__)
#To print out method documnet from class
print(Circle.area.__doc__)
##To print out simple function Document
print(CustomFunction.__doc__)
#To printout all document of class then we can use help function
help(Circle)
#to printout all data about predefined objects
help(list)