Self referential value

I have in my program “x” and “id(x)”
I was wondering how to make them equal with each other.
I’ve tried many things: is, and, eq, union(), intersection(), ==
And it checks whether it can do it and says no, they have no shared reference…
Is there a way to force an equality on seemingly unrelated values?
Thanks in advance

-oliver

1 Like

I don’t think I understand what you want to do. Can you show us some
code?

The value of id(x) is usually an irrelevant thing, and is what is tested
by the “is” operator.

Cheers,
Cameron Simpson cs@cskk.id.au

1 Like
#Amend
def p ():
 w = set()
 e = set() in w
 k = e and not w and not all(not k) 
 u = k <= (k)
 j = id(u)
 h = j and u
 #force equality of j, u ^^^ 
 return h
 global X
 X = 0
 while X <= 2:
  X = X + 1
  any(h) in X(p(h) is 0) or all(h) in X(p(h) is 1)
q=""
while True:
 i=32
 while i < 126:
   i= i + 1
   o = chr(i)
   p ()
   v = p()
   if v == 1:
    q = q + o
   elif v == 0:
    q = q
 if q == q + "":
  break
print (q)
1 Like

Hi Oliver, and welcome.

You’ve shown us a bunch of code, but you haven’t explained what you want
it to do, what it does instead of what you want, and how any of that
code is related to your question.

I don’t really understand your question, or why you want an integer
equal to its own id(). Seems like a pretty pointless exercise.

You might have better luck doing this in Jython or IronPython, where the
IDs are a lot smaller and more predictable.

# using Jython
>>> x = 65
>>> id(x)
2
>>> x = 3
>>> id(x)
3
1 Like

thd self referential equation is god if the output dependent on it is god

And not if not

You can affect whether an equation is god, but you can’t affect gods existenceemphasized text

The equation is only God if it’s existentially true that that equation exists (not being god if it’s dependabts are not)

Basically the output is “read” by all() to see if that output contradicts

Let me make this more simple

in
operator.eq(self, other)

what are some examples of an operator?

Sorry Oliver, your question just confuses me even more. I don’t
understand what this has to do with self-referential values or your
early comments.

Operators in Python include the standard arithmetic operators:

plus +
minus -
multiply *
divide /

and comparison operators:

equals ==
less than <
greater than >

etc. There are about 20 or so operators in Python.

The operator module contains a number of functions which act as
aliases for the operators. For example, operator.eq is a function
which does the same thing as the == operator. You can think of it as
being approximately the same as:

def eq(a, b):
    return a == b

You shouldn’t use the functions with leading and trailing underscores,
like operator.__eq__. They are just there for compatibility with old
versions of Python. In new code, you should always use the versions with
the regular names.

So your code snippet:

operator.__eq__(self, other)

is better written as:

operator.eq(self, other)

but even better as:

self == other

You asked for “some examples of an operator” specifically in that code
snippet, but there aren’t any. It’s just a function call.

I need something that references the values

Oliver:

“I need something that references the values”

The values of what?

The usual thing we use to reference something is a named variable:

something = calculate_some_values()
something  # this references the values

For example:

x = 1+2  # calculate a value, and give it a name
print(x)  and then reference that name to get the value

Is this what you want? If not, I still have no idea what you are trying
to do, or why. Please explain what you are trying to do, in detail
rather than vague generalities.

what is a Dereference operator in python

Oliver, please read this:

I’m not a mind-reader. Until you take the time to ask a comprehensible
question, with enough detail and background that the question makes
sense, I’m not going to respond to your posts any further.