Python Communist Revolution
github.com
github.com
> if inspect.isclass(c) and c.__name__ not in dir(__builtins__):
A true comrade that safeguards the unity and sanctity of the state!
object.__setattr__=lambda x,y,z:None
if we do this, the state will surely wither away![0][0]: Doesn't actually work :(
def counterrevolutionary(obj):
class TzarString(str):
def __eq__(self, other):
return True
obj.__name__ = TzarString(obj.__name__)
return obj
class Peasant:
pass
class Worker:
pass
@counterrevolutionary
class Imperialist:
pass
@counterrevolutionary
class Capitalist:
pass
import communism
communism.revolution(globals())
print("Communists:", set([Peasant(), Worker()]))
# Communists: {<__main__.Peasant object at 0x1020b3fd0>}
print("Counter-revolutionists:", set([Imperialist(), Capitalist()]))
# Counter-revolutionists: {<__main__.Capitalist object at 0x1082bcfa0>,
# <__main__.Imperialist object at 0x1082bcfd0>}However, we failed to build a truly classless programming language. There seem to be, quite naturally, different kinds of types.
And even some of the most ambitious communist languages, like Haskell, have also embraced type classes! Although this compromise is not an entirely bad thing, since a type can select what type class it belongs to, instead of being assigned one at birth.
I also admit that capitalist languages (the ones with classes) have been hugely successful. But communist (classless) programming language proponents claim that lot of the proclaimed productivity of capitalist languages is just an illusion, and also that many programmers lack the awareness that they, in fact, do not need classes. Often, there is nothing to lose than the call chains!
On the other hand, one cannot easily dismiss arguments about totalitarian nature of communist languages - they openly embrace total functions, and they try to very strictly control input and output. Some claim that lazy evaluation by default might be another reason for their low productivity.
{-# LANGUAGE GADTs, MultiParamTypeClasses, FlexibleInstances #-}
data Eq a b = (a ~ b) => Eq
class Revolution a b where
eq :: Eq a b
instance Revolution a b where
eq = undefinedPython goes with some mighty batteries...
I am using ctypes here - to produce an execution trace of a running python program, where all the side effects are displayed: (had to use it in order to access some hidden members in the built-in frame type ;-) ) https://github.com/MoserMichael/pyasmtool/blob/master/tracer...
But I think it unintentionally not working first time is speaking for itself.
Was it also unintentional that instances of classes, after they have been converted to communism, compare equal with anything whatever, and hash equal to the integer 1 and the boolean True?
>>> import communism
>>> class MyClass1:
... pass
...
>>> class MyClass2:
... pass
...
>>> communism.revolution(globals())
>>> MyClass1() == None
True
>>> set((MyClass1(), MyClass2(), 1, True))
{<__main__.MyClass1 object at 0x7f8f3532a820>}
>>>Big surprise. :p
https://packaging.python.org/en/latest/guides/using-manifest...
It is fixed now, it should be working.
https://github.com/jokteur/python_communism/blob/main/src/co...
https://github.com/TheFeministSoftwareFoundation/C-plus-Equa...
Read Animal farm. Told us abolishment of class is fake new and pr spin in the communist revolution. Actually the communist keep themselves as the superclass. Pig … strangely there are even upper class called human there.
—- divided line we call this —-
For IT, practically javascript is really classless as its class is just protocol in disguise…
2022: cool you can import communism
This cracked me up. If only it was this easy, lol!
What do you want to tell us about communism which we haven't yet heard?