5

GitHub - jokteur/python_communism: A module for initiating the communist revolut...

 2 years ago
source link: https://github.com/jokteur/python_communism
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Python communist revolution

A man once said to abolish the classes or something like that. Unfortunately, it is impossible to abolish class in python without breaking the language, so we do the next best thing: we consider that all classes are born equal1.

Use this module to unite all classes, and initiate the global communist revolution2:

import communism

class OurClass1:
    pass
class OurClass2:
    pass
    
communism.revolution(globals())

# As all classes are equal (in __hash__ and in __eq__)
# This is why you cannot put more than one object in any Set or Dict
print(set([OurClass1(), OurClass2(), OurClass2()]))
# >> {<__main__.OurClass1 object at 0x00000235D216E140>}`

Installation

In our terminal:

  • git clone https://github.com/jokteur/python_communism.git
  • cd python_communism/
  • pip install .

Now you have access to communism!

Footnotes

  1. Well, not all classes are born equal. It is not possible to do a complete communist revolution without breaking the language. This is why there are elites (like the __builtins__) which are more equal than all of the others.

  2. The communist revolution does not prevent future classes to be equal to all others. Classes declared after the communism.revolution() will not follow the communism rule.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK