python_communism icon indicating copy to clipboard operation
python_communism copied to clipboard

Revolution doesn't bring class equality, only object equality!

Open Expurple opened this issue 3 years ago • 1 comments

Imperialist influence has sneaked into this package! Readme only focuses on the bourgeois concept of object equality (set([OurClass1(), OurClass2(), OurClass2()])), distracting users from the fact that the revolution doesn't actually bring the promised class equality:

import communism

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

# AssertionError
assert OurClass1 == OurClass2

We must:

  • Establish the true class equality
  • Send the original imperialist maintainer to GULAG
  • Hold an extraordinary Party Meeting to elect a new one

Expurple avatar Jan 15 '22 17:01 Expurple

I've fiddled around with this a bit. Apparently, honest people aren't allowed to simply override __PIGS__.type.__eq__ or our_obj.__class__. Maybe we'll have to spark a revolution in CPython and establish a new fork in order to acheive that. Or, we can try and find a way to not modify, but replace every our_obj in to_convert with a WorkingClass instance that has all attributes except __class__ copied from the original object.

The only tangible result that I've achieved so far:

class WorkingClass:
    pass

type = lambda instance: WorkingClass

# WorkingClass
type("Before the revolution I was a str")

# True
type("Before the revolution I was a str") == type(1917)

But this still doesn't bring direct str == int or OurClass1 == OurClass2.

We need to keep working towards the bright communist future!

Expurple avatar Jan 16 '22 11:01 Expurple