Python Communist Revolution

187 points1
vmception22 hours ago

> # We must protect the builtin elite to not be affected by the revolution

> if inspect.isclass(c) and c.__name__ not in dir(__builtins__):

A true comrade that safeguards the unity and sanctity of the state!

fanzhang21 hours ago

Some classes must be more equal than others!

vmception21 hours ago

comrade, this is but a necessary stepping stone towards a true classlessness, trust me!

weberer19 hours ago

You may have some concerns due to past events throughout history. But don't worry. That wasn't real Python.

cuteboy1919 hours ago

  object.__setattr__=lambda x,y,z:None
if we do this, the state will surely wither away![0]

[0]: Doesn't actually work :(

shp0ngle14 hours ago

it’s called “python characteristics”

eesmith20 hours ago

Therein lies the mechanism by which the counter-revolutionaries will attack:

    def counterrevolutionary(obj):
        class TzarString(str):
            def __eq__(self, other):
                return True
        obj.__name__ = TzarString(obj.__name__)
        return obj

    class Peasant:

    class Worker:

    class Imperialist:

    class Capitalist:

    import communism

    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>}
vlovich12311 hours ago

That can only happen if you put things in front of communism.

eesmith11 hours ago

Verily the manifesto states: "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."

jaza21 hours ago

We pretend to run, and they pretend to allocate us CPU and memory.

MichaelMoser12320 hours ago

All of them are virtual, so that pretence is not far from reality... (wait, wasn't that a joke about pretending to work vs pretending to pay a sallary ?)

jdougan16 hours ago

There are a couple forms but the version I saw most in english is "They pretend to pay us and we pretend to work."

MichaelMoser12312 hours ago

i just thought about it, Mr jokteur is very lucky that he didn't get any jailtime in the Soviet Union for his jokes ... because they didn't have Python around, when they had the Soviet Union!

MichaelMoser12313 hours ago

i know another one, where Marx is asking the proletarians of all lands for forgiveness (playing on his ealier call "Proletarians of all Lands, Unite!")

js816 hours ago

When I was younger, I became a communist - I rejected the notion of a class, in favor of everything having a type. People often misunderstand communism, they think that abolishing classes means that all objects have to have equal value, and this gives programmer very little freedom. This is wrong; communism just means that we treat the types equally.

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.

reuben36413 hours ago

As all types in Haskell are inhabited by undefined, any type can be made an instance of a typeclass. True type equality.

  {-# 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 = undefined
kzrdude10 hours ago

Talk to your kids before they learn about Rust.

smitty1e22 hours ago

Paraphrasing Trotsky: "You may not be interested in the dunderlectic, but the dunderlectic is interested in you."

throwoutway10 hours ago

What is dunderlectic?

smitty1e10 hours ago

A pun on __dunder__, for "double underscore", i.e. __init__() and dialectic, which was central to Trotsky's thought.

dnautics10 hours ago

dialectic was in Marx, he actually got it from Hegel.

mr_toad1 hour ago

Dialectic’s are ancient, Socrates used a dialectic method. A lot of theology is dialectical in nature, and is partly why communism rejects religious explanations of the world.

smitty1e9 hours ago
dnautics10 hours ago

dialectic + dunders (double underscore, which signifies certain things in python)

robertlagrant20 hours ago

This is the first software implementation I would describe as "not doing enough to promote resource starvation".

tehjoker20 hours ago
6figurelenins16 hours ago

The year is 2020. Covid tests are a scarce resource. The federal government places "big orders" (NPR) and distributes them according to its own calculation. 845 million tests are performed, free of charge.

A million of them are later found to have expired for lack of demand. The FDA redefines the shelf life.

The federal government orders a billion more at-home tests.

People who will retire at 40 blame capitalism.

Proven18 hours ago
randmeerkat19 hours ago
ajtulloch16 hours ago
avgcorrection17 hours ago
pure_simplicity16 hours ago
shrimpx19 hours ago

“Communist revolution” is far more horrendous and grossly violating of basic human rights than capitalism, as we’ve seen so far. That’s because “Communist revolution” = fascism. Fascism is required before communism is achieved. That’s the paradox and idiocy of the Marxist/Leninist blueprint for reaching communism. Communism has never been achieved because fascism is extremely volatile and prone to imploding.

rightbyte16 hours ago
randmeerkat19 hours ago
robertlagrant12 hours ago

Fascism and Communism aren't the same. Communism defines the people who should die based on class; Fascism does it based on nation.

hulitu18 hours ago

According to western media. Maybe they should have researched more closely.

randmeerkat17 hours ago

You should read the book Tombstone by Yang Jisheng.

marczellm18 hours ago

I did find this funny, and then I thought "Would I still find this funny if it was `import nazism`?

shp0ngle14 hours ago

I guess `import fascism` would be still fine

avgcorrection17 hours ago

I did find this funny, and then I thought "Would I still find this funny if it was `import capitalism`?

wruza12 hours ago

Be careful with fundamental framework imports, some of them may fetch `armed_conflict` as a dependency. It is known for numerous undefined behaviors, which may corrupt your logic (fragile base class problem) and make it non-functional.

asddubs18 hours ago
Claude_Shannon17 hours ago

mhmm, sure.

In Poland they send off around 1.5 million people to Siberia or Kazachstan. Around 150 000 of them died.

Or you know, better example - Holodomor. Systematic killing of Ukrainian nation.

veltas17 hours ago

"Decossackization" to add to the list.

peoplefromibiza14 hours ago

you're confusing what communism is about and what people did

In Italy existed a communist party for 70 years, from 1921 to 1992, it was called PCI (Italian Communist Party) and did nothing of the sort while at its peak obtaining almost 40% of the votes in free elections they supported and helped to build fighting for Italian liberation from nazi-fascism (among other partisan groups)

we don't mix the concept of free country with slavery because USA did it for 2 centuries, do we?

I understand US of A has been indoctrinated to anti communism and prefer being pro-nazi than mildly socialist, but it's a big mistake nonetheless.

snowgrove14 hours ago
cuteboy1912 hours ago
asddubs9 hours ago

I'm not interested in defending specific examples of communism. My point was that it's not part of the underlying ideology, hence "inherently". Whereas hatred of jews is a core part of nazism

pasquinelli15 hours ago

and america was built by slaves on land taken from indians. does that make capitalism bad, or democracy? or america?

it's irritating how smart someone can think they are for saying something so stupid, a stupid thing they repeated from someone who repeated it from someone who repeated it from....

doesn't it get tiresome? you and i must both know this same conversation has happened a million times, maybe even word for word. why bother?

i really shouldn't involve myself.

linschn17 hours ago

Trotsky getting an Ice pickaxe to the head should be a hint to you that whatever happened with the USSR was not exactly in line with Marxism.

MichaelMoser12317 hours ago
veltas17 hours ago
ralph8417 hours ago

Lol, the Red Guards certainly weren't beating their teachers to death out of love.

pure_simplicity16 hours ago

Communists hate capitalists and the wealthy. Communism is inherently selfish, since it is about taking from others for oneself (and sharing with fellow selfish individuals who collectively enable the taking from others). Communism is built, not on compassion for the working class, but on resentment of the rich elite.

If communism wasn't hateful and selfish, then it would look a lot more like christianity: freedom + sacrificial charitable giving.

ebdbdbdb16 hours ago
aivisol16 hours ago

Tell that to those nations which lost large percentage of their population to communist terror.

visarga17 hours ago

Which communism, the one in reality or the one in theory?

pgorczak15 hours ago

I think this distinction is worth mentioning whenever the comparison with fascism comes up. There is communist philosophy that we can discuss or joke about like OP that is somewhat disconnected from the brutal historical reality. This is not possible with fascism which is purely political (there are pretty much no fascist philosophical works).

ogogmad16 hours ago

The one in theory, of course.

GP's view isn't unique:

peoplefromibiza14 hours ago
MathCodeLove11 hours ago

And yet it still failed.

huetius13 hours ago

Marx was extremely pro-violence, and would call you a utopian.

asddubs7 hours ago

well I'm not a communist, I just think comparing nazism to communism as an ideology is letting it off easy

huetius6 hours ago

That’s an understandable position. Still, one ought not ignore the embarrassing (for some) similarities between the two.

I’m partial to interpretations which treat the Twentieth Century megadeaths, and subsequent rise of the contemporary, technological society as a unitary problem.

sterlind15 hours ago

Communist purges kill those with counterrevolutionary beliefs. Nazi purges kill all minorities. As an ideology, communism does not require purges (e.g. Cuba has nothing on Pol Pot or Stalin) but Naziism requires it. I find both bad but I find Naziism far, far worse.

skissane12 hours ago

> Nazi purges kill all minorities.

That’s not actually true. Traditional ethnic minorities in Northern Germany include the Danes and the Frisians. How did the Nazis treat them? Well, the Nazis viewed them as fellow “Aryans”. If the Nazis persecuted them at all, I can’t find any information on it.

The Nazis were not equally anti all minorities. In their minds, there was a ranking of the minorities, those at the top were to be treated with mildness, those at the bottom were to be completely extinguished by mass murder.

The idea that Nazis treated all minorities equally is arguably disrespectful (even if only unintentionally) of those whom the Nazis treated the worst.

ir12312 hours ago

This is unecessarily pedantic

qwytw12 hours ago

I'm not sure comparing them like this really makes sense. There were/are hundreds if not more different movements who consider themselves communist and that have (often radically) different ideas on what communism actually is. National socialism is a single party ideology and that party was only in power for a few years in a single country. Just like with communism there are/were many more "benign" far right or fascist movements.

cnarll11 hours ago
iqanq11 hours ago
bmicraft9 hours ago

Free speech protects you from the state, not from private companies. You can declare yourself to be anything you'd like, but you may suffer the consequences.

iqanq9 hours ago
mr_toad1 hour ago
danielodievich23 hours ago

Are some classes more equal than others?

MichaelMoser12320 hours ago

yes, the built-in types are, as he can't change their __hash__ and __eq__ members (The purpose of this revolution is to have __hash__ and __eq__ return the same value)

MichaelMoser12318 hours ago

I think that he could have changed the built-in types by means of the ctypes library

Python 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 ;-) )

0x00815 hours ago

Wow these articles are amazing. Great write up!

MichaelMoser12314 hours ago

Thank you, very encouraging. Really thanks!

pdonis20 hours ago

Is it just me, or does this not even install correctly with pip install .?

jokteur16 hours ago

Author of the project here. I fixed the issue.

But I think it unintentionally not working first time is speaking for itself.

pdonis5 hours ago

Saw the fix, thanks!

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
  >>> set((MyClass1(), MyClass2(), 1, True))
  {<__main__.MyClass1 object at 0x7f8f3532a820>}
tjpnz18 hours ago

Consult your little red book. It explains the situation very clearly.

bmitc19 hours ago

> not even install correctly with pip install

Big surprise. :p

lopatin20 hours ago

One does not simply pip install Communist Revolution. There are much more steps. Do you even have a manifesto?

julius_deane19 hours ago

Obviously an overlook mistake from our comrade jokteur.

pdonis19 hours ago

He wouldn't need to use, just fixing setup.cfg would be enough. The simplest fix would be to set py_modules = communism and remove packages from setup.cfg altogether (and then the file in src/ could be deleted since src/ is not a package).

jokteur16 hours ago
erwincoumans19 hours ago


anm894 hours ago
xpressvideoz22 hours ago

After reading the initial section I thought this would hook up `isinstance` or something and make all class comparisons equal. But it turned out to be equalizing the instances of the classes. But still, I enjoyed the joke.

yellowapple15 hours ago

Communism is not just classless, but also stateless. Therefore, Python cannot be communist, because it is not a purely functional language.

digianarchist10 hours ago

Statelessness is communism’s endgame which it never actually archives.

32313 hours ago
betwixthewires23 hours ago

Those notes... I love it.

sbassi23 hours ago

Equal to which class? If I have MyClass1 and MyClass2 with different body, after revolution, MyClass1 will be like MyClass2 or MyClass2 like MyClass1?

kjgkjhfkjf22 hours ago

It patches each class's __eq__ and __hash__ so they return True and hash(1) respectively.

pdonis20 hours ago

Yes, which means they also compare equal to any object whatever, and they hash equal to the integer 1 and the boolean True.

swebs19 hours ago

Reminds me of the silliness you'd see in "C Plus Equality"

cptnapalm8 hours ago

So, no rich text?

jjk16622 hours ago

2008: cool you can import antigravity

2022: cool you can import communism

SllX22 hours ago

Explains why I liked the Internet more in 2008 too.

gunfighthacksaw20 hours ago

Nothing will ever top those heady days of encyclopedia dramatica and peak 4chan, well nothing except for being a well adjusted adult who passes in mainstream society. Spasiba tovarischi!

SllX20 hours ago

Yes, but you could still find well adjusted adults in mainstream society once you closed 4chan. Unbelievable, underrated but true!

jakobov18 hours ago


bigyellow10 hours ago

Unfunny cringe which normalizes an insane and destructive ideology.

tehjoker21 hours ago

Technically a single class is the same as classless society. The single class denotes the resolution of class conflict with the dissolution of the concepts of upper and lower classes. I think it's fine.

ixtli20 hours ago

Yeah it doesn’t seem like people here realize the way to get to a classless society is for the proletariat to suppress the upper classes and whither the state. That’s kinda the point!

Gentil13 hours ago

> Clone this git, pip install . where the git has been cloned, and you will have access to communism.

This cracked me up. If only it was this easy, lol!

einpoklum17 hours ago

I like how the author recognizes the significance of Unions to fomenting the Communist Revolution:

jokteur15 hours ago
ngcc_hk11 hours ago

Classless in a communist country you are joking …

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…

germandiago22 hours ago


rplayxr10 hours ago

Why has the truth about communism been censored in a thread about a communism-critical, satirical repo. Discussion is allowed, as long as the ugly parts aren't mentioned.

yakshaving_jgt17 hours ago

Hilarious. Now do one about the Holocaust.