Python is an open source programming language created in 1991 by Guido van Rossum.
#3on PLDB | 33Years Old | 9mRepos |
git clone https://github.com/python/cpython
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...
def square(num):
return num * num
print("Hello, world!")
#!/usr/bin/env python2.4
print "Python"
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
Feature | Supported | Example | Token |
---|---|---|---|
Standard Library | โ | print("Hello, World!") | |
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 | โ | ||
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): 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: pass class Base2: pass class MultiDerived(Base1, Base2): pass # Or multilevel inheritance: class Base: pass class Derived1(Base): pass class Derived2(Derived1): pass | |
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 | โ | # https://easyaspython.com/mixins-for-fun-and-profit-cb9962760556 class EssentialFunctioner(LoggerMixin, object): | |
Iterators | โ | https://www.w3schools.com/python/python_iterators.asp | |
Infix Notation | โ | seven = 3 + 4 | |
File Imports | โ | import datetime oTime = datetime.datetime.now() from my_pkg import my_funcs | |
Assignment | โ | name = "John" | = |
Directives | โ |
from __future__ import feature
# coding= |
|
Generators | โ | https://wiki.python.org/moin/Generators | |
Constructors | โ | ||
MultiLine Comments | โ | ''' A comment. ''' | ''' |
Comments | โ | # A comment | |
Conditionals | โ | if True: print("Hello world") | |
Classes | โ | class Person (object): def __init__(self, name): self.name = name | |
Booleans | โ | True False | |
Dynamic Properties | โ | class Person (object): def __init__(self, name): self.name = name person = Person("John") person.age = 50 | |
Symbol Tables | โ | # https://eli.thegreenplace.net/2010/09/18/python-internals-symbol-tables-part-1 | |
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 https://peps.python.org/pep-0435/ | |
Macros | X | ||
Variable Substitution Syntax | X |