
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 10419 Articles for Python

1K+ Views
I would recommend generateDS for converting a XSD file to a Python class . In my opinion, it is a good tool for the said purpose.It (generatS) generates the Python class with all methods (setters and getters, export to XML, import from XML). It does a good job and works very well !.

457 Views
In Python, when a class is derived from more than one super-class or base class, it is known as multiple inheritance. Following is the syntax of multiple inheritance in Python - class Super1: pass class Super2: pass class MultiDerived(Super1, Super2): pass Example ofMultiple Inheritance Let's understand multiple inheritance with the following example. Here, we have created two superclasses or base classes, i.e., Superclass1 and Superclass2, and the derived class is the child class. We then create an object Obj_1 of the child class to call its methods as ... Read More

2K+ Views
In Python there are no private variables in classes. By default all the variables and methods are public. There is sometimes an emulation of private variables by using the double underscore __ prefix to the variable's names. This makes these variables not easily accessed outside of the class. This is achieved through name mangling. In name mangling, we declare data/method with at least 2 leading and at most 1 trailing underscore. The name mangling process helps to access the class variables from outside the class. The class variables ... Read More

6K+ Views
The object-oriented procedural programming, including the ideas of classes and objects, is well supported by Python. It offers a crystal-clear program structure and simple code modification. The code can be reused and offers many benefits of abstractions, encapsulation, and polymorphism due to the class's shareability. A Python class is a "blueprint" for creating objects in Python is a class. Getting Class name of an instance in Python To determine a Python instance's class name there are two ways − Using the type() function and __name__ function. Using the combination of the __class__ and __name__. A unique built-in variable ... Read More

15K+ Views
In OOP languages methods are a piece of code that can perform a specific task to produce a desired output. Methods are created inside classes and are invoked or called by objects of the class. Methods are extremely useful in programming as they provide modularity to code by breaking a complex code into manageable blocks. Methods can function independently of other methods, thus making it easy to check individual functionality within a program. Method chaining in Python Methods chaining is a style of programming in which invoking multiple method calls occurs sequentially. It removes the pain of assigning variables at ... Read More

738 Views
In Python, the variables that are declared inside the class are known as attributes. These attributes can be accessed and modified by both the class and its objects. Following are the two types of attributes - Class Attributes: The attributes that are defined globally in the class are known as class attributes and can be accessed throughout the class itself and are shared between all class instances. They can be accessed using the class name. Instance Attributes: The attributes that are defined inside the __init__() method are known as instance attributes. ... Read More

5K+ Views
A class is a group of items. It is a logical entity with a few unique attributes and methods. For instance, if you have a class for Cricket, it should have an attribute and method like players, tournaments, toss, runs, wickets, matches, etc. Use the keyword ‘class’ to create a class. Example: Following is a simple example of a class − Create the class named ‘Python’ and give it the property a − class Python: a = 36 This article demonstrates the following different ways to dynamically load a Python class. Using getattr() function The named attribute of ... Read More

4K+ Views
In this article we are going to discuss how to handle the circular dependency between Python classes. First of all, let us understand what is circular dependency. When two or more modules depend on one another, this is known as a circular dependency. This is because each module is defined in terms of the other module. Following is an example of circular dependency functionE(): functionF() And functionF(): functionE() The code shown above clearly shows a circular dependency. FunctionA() calls functionB(), which depends on it, and functionB() calls functionA().There are some apparent issues ... Read More

3K+ Views
Python code is organized in files called "modules" and groups of related modules called “packages".A module is a distinct unit that may have one or more closely-related classes. Modules need to be imported before they are read, used, maintained and extended if needed. So a module is a unit or reuse.The rule is this: a module is the unit of reuse. Everything in Python libraries and other Python applications is either a module or a package of modules.There is no limit on how many classes one can put in a file or a module. It all depends on how big ... Read More