I have just started learning python, I am a Java programmer. I think python is more simple than java. What I wanted to ask is, where is python used? And if python does not follow the complete OOP concepts, then can it be used to design large / major applications?

Few more question :
If I need to import a function from a module, I do module_name.function(), I guess this is correct.
Now if I have a class with name test which is in the module temp. Class test has a function func().

1) Can I call this function simply as module_name.function() 
2) Or I have to call it like object_name.func() 
t = test

Any help will be great. Also, I am sorry if I have posted this is in wrong section.

6 Years
Discussion Span
Last Post by snippsat

You could check places like



Which try to explain Python for people with Java background

For using of classes, it is best to try to read some example programs, like


Thank for the link, they were helpful.
I just wanted to know that if I am calling a base class from a derived class, then I have to use the "module name . function name" or the "object name.function name". I know that the second one is true, but I have not test the first one. Also if a function from the base class can be called by using "module name . function name". What is the mechanism behind this and where is this useful.


Where is python used?


YouTube is coded mostly in Python. Why? “Development speed critical”.
They use psyco, Python -> C compiler, and also C extensions, for performance critical work.
They use Lighttpd for serving the video itself, for a big improvement over Apache.

Most of the Spotify backend is written in Python, with smaller parts in C and Java,

Google has this filosofy
"Python where we can, C++ where we must"

Python dos not need to wrap code in class to make it work as in java.
This make it easy to test small part off the code.
Python vs java

Some basic off the python class you can look at.

class SimpleClass(object):
  '''Doc string info about class'''  
  # Class attributes as you see this is variables
  # They the belong to a class therefor the name 'attributes' 
  x = 5
  y = 10
  s = x + y
  def __init__(self, string):    
     This is the constructor in python you need only 1 constructor
     Self is the class glue,and it also transport data between metods
     When you make_objekt everything in this method get run because of __init__ 
     self.string = string
     print 'In the constructor'
     print 'Value from argument -->', string
     print ''     
  def SayHello(self, string):
    '''This is a function,but in a class it is called a method'''
    print 'Hi, ' + string + '.'
  def data_get(self):
    '''Recive data from __init__'''
    print 'Data from __init__ -->', self.string  #Try without self          

# Run one and one line try to understand whats happens    
make_object = SimpleClass('hello')  #Class instance
#make_object_new = SimpleClass("argument from new object")  #New class instance 

#make_object.SayHello('This is Python and i like it')   #Call method SayHello()  
#make_object_new.SayHello('Object_new like python to')  #Call method SayHello() from new object

#make_object.data_get()     #Call method data_get()

#print make_object.x        #Call attribute 
#print make_object.s        #Call attribute 
#print make_object_new.y    #Call attribute from new object

#print make_object.__doc__  #Print doc string
#print help(SimpleClass)    #Print help for this class

Here we look at a more useful class that can filter out spam and Inheritance from an other class.

class Filter:
    def __init__(self):
        '''This is the constructor ***'''
        self.blocked = []
    def filter(self, sequence):
        '''This is a method | outside a class it`s called a function'''
        return [x for x in sequence if x not in self.blocked]
class SPAMFilter(Filter):
    '''SPAMFilter is a subclass of Filter'''    
    def __init__(self):
        '''Overrides init method from Filter superclass'''
        self.blocked = ['SPAM']
if __name__ == "__main__":
    f = Filter()  #Class instance ***constructor is used
    Filter is a general class for filtering sequences.
    Actually it dos nor filter out anything
    We have to use SPAMFilter class
    print f.filter(['SPAM','eggs','bacon', 'SPAM'])
    ###--> ['eggs', 'bacon']
    The usefulness of the Filter class is that it can be used as a base class (superclass)
    for otherclasses.
    Such as SPAMFilter, which filters out 'SPAM' from sequences
    s = SPAMFilter()
    print s.filter(['SPAM','eggs','bacon', 'SPAM'])    
    ###-->['eggs', 'bacon']

This line i dont understand,then you can test out in IDLE.
return [x for x in sequence if x not in self.blocked]

IDLE 2.6.5  
>>> sequence = ['SPAM','eggs','bacon', 'SPAM']
>>> blocked = 'SPAM'
>>> [x for x in sequence if x not in blocked]
['eggs', 'bacon']
>>> #It work this it called list comprehensions
>>> #we can write it like this

>>> l = []
>>> for x in sequence:
	if x not in blocked:
>>> l
['eggs', 'bacon']
#This show a little of the power of python

Edited by snippsat: n/a

This article has been dead for over six months. Start a new discussion instead.
Be sure to adhere to our posting rules.