Questions Concepts
GitHub icon


Python - Programming language

< >

Python is an open source programming language created in 1991 by Guido van Rossum.

Source code:
git clone
#3on PLDB 32Years Old 9mRepos

Try now: Riju ยท Replit

Python is a widely used high-level programming language for general-purpose programming, created by Guido van Rossum and first released in 1991. An interpreted language, Python has a design philosophy that emphasizes code readability (notably using whitespace indentation to delimit code blocks rather than curly brackets or keywords), and a syntax that allows programmers to express concepts in fewer lines of code than might be used in languages such as C++ or Java. It provides constructs that enable clear programming on both small and large scales. Read more on Wikipedia...

Example from Compiler Explorer:
def square(num): return num * num
Example from Riju:
print("Hello, world!")
Example from Linguist:
#!/usr/bin/env python2.4 print "Python"
Python Keywords
and as assert break class continue def del elif else except False finally for from global if import in is lambda None nonlocal not or pass raise return True try while with yield

Language features

Feature Supported Token Example
Scientific Notation โœ“
Binary Literals โœ“
# 0[bB](?:_?[01])+
Floats โœ“
# (\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)([eE][+-]?\d(?:_?\d)*)?
Hexadecimals โœ“
# 0[xX](?:_?[a-fA-F0-9])+
Octals โœ“
# 0[oO](?:_?[0-7])+
Functions โœ“
While Loops โœ“
Case Sensitivity โœ“
Print() Debugging โœ“ print
Threads โœ“
Line Comments โœ“ #
# A comment
Dispose Blocks Pattern โœ“
with resource_context_manager() as resource:
   # Perform actions with the resource.
# Perform other actions where the resource is guaranteed to be deallocated.
Zero-based numbering โœ“
Strings โœ“
"hello world"
Inheritance โœ“
class SumComputer(object):
   def __init__(self, a, b):
       self.a = a
       self.b = b
   def transform(self, x):
       raise NotImplementedError
   def inputs(self):
       return range(self.a, self.b)
   def compute(self):
       return sum(self.transform(value) for value in self.inputs())
 class SquareSumComputer(SumComputer):
     def transform(self, x):
         return x * x
 class CubeSumComputer(SumComputer):
     def transform(self, x):
         return x * x * x
Semantic Indentation โœ“
class Person (object):
  def __init__(self, name): = name
Operator Overloading โœ“
# Python Program illustrate how  
# to overload an binary + operator 
class A: 
    def __init__(self, a): 
        self.a = a 
    # adding two objects  
    def __add__(self, o): 
        return self.a + o.a  
ob1 = A(1) 
ob2 = A(2) 
ob3 = A("Geeks") 
ob4 = A("For") 
print(ob1 + ob2) 
print(ob3 + ob4)
Multiple Inheritance โœ“
class Base1:
class Base2:
class MultiDerived(Base1, Base2):
# Or multilevel inheritance:
class Base:
class Derived1(Base):
class Derived2(Derived1):
Lists โœ“
myList = [1, 2, 3, 4, 5]
Integers โœ“
pldb = 80766866
Multiline Strings โœ“
template = """This is the first line.
This is the second line.
This is the third line."""
Mixins โœ“
class EssentialFunctioner(LoggerMixin, object):
Iterators โœ“
Infix Notation โœ“
seven = 3 + 4
File Imports โœ“
import datetime
oTime =
from my_pkg import my_funcs
Assignment โœ“ =
name = "John"
Directives โœ“
from __future__ import feature
# coding=
Generators โœ“
Constructors โœ“
MultiLine Comments โœ“ '''
''' A comment.
Comments โœ“
# This is a comment
Conditionals โœ“
if True:
 print("Hello world")
Classes โœ“
class Person (object):
  def __init__(self, name): = name
Booleans โœ“ True False
Dynamic Properties โœ“
class Person (object):
  def __init__(self, name): = name

person = Person("John")
person.age = 50
Symbol Tables โœ“
Shebang โœ“
#!/usr/bin/env python
Bitwise Operators โœ“
x << y
Ternary operators โœ“
print(1 if 1 else 0)
Single Dispatch โœ“
Duck Typing โœ“
Disk Output โœ“
with open('helloworld.txt', 'w') as filehandle:
 filehandle.write('Hello, world!\n')
Units of Measure X
Pointers X
Case Insensitive Identifiers X
Regular Expression Syntax Sugar X
Enums X
# Though there is an Enum class in stdlib
Macros X
Variable Substitution Syntax X

View source

- Build the next great programming language ยท Search ยท Add Language ยท Features ยท Creators ยท Resources ยท About ยท Blog ยท Acknowledgements ยท Queries ยท Stats ยท Sponsor ยท Traffic ยท Traffic Today ยท Day 305 ยท ยท Logout