How can I know that I exist (Using Python)

87 views Asked by At

How can I prove my existence using lines of code, is there a way an interaction between me and my CLI can provide me with assurance I exist, that everything around me is not a lie or unreal?

2

There are 2 answers

0
Green Cloak Guy On

Inside a class:

class Entity:
    def do_I_exist(self=None):
        if self:
            return True
        return False

You can call it either as an instance method or a class method:

>>> Entity.do_I_exist()
False
>>> Entity().do_I_exist()
True

If called as an instance method on an object, then it must be the case that the object exists. If called as a class method, it returns false, showing that no such object exists.


Outside the code this can be considered a matter of philosophy, and thus out of scope. The Wikipedia page on cogito, ergo sum may be helpful for you in solving this dilemma.

1
dabhand On

In bash:

python -c "import this" | sed -n '14p'