41
wowotek
6y

Shower Thought :
maybe i need to call JS equal signs like this :
x = 3; // x is 3 now
x == 3; // does x is equal to 3 ?
x === 3; // does x is Fucking equal to 3?

Comments
  • 2
    @devTea good morning !
  • 5
    @wowotek Good morning sir
  • 4
    I usually say "equals" for == and "congruent to" for ===
  • 5
    @mjones44 or “similar to” vs “most fucking definitely the same thing as”
  • 2
    Hm what about an equals convention that test "shallow vs deep copies". Like an equals that returns true if operands refer to the same object in memory..
  • 3
    // does X equals equals equals to 3
  • 1
    @trollonaboat you mean python's `is`?
  • 1
    @Supersebi3 hey! Thanks for suggesting "is". "is" checks whether 2 aliases refer to the same object.

    But .. hmm.. what if said object contains another object:

    class A():
    Self.b =B()

    A shallow copy of object "A" occupies another memory location while referring to the same object "B".

    Seems like
    objA is objA.copy()
    returns False

    But the carried objects "B" are the same.

    Not asserting but just wondering... 🤔
  • 1
    @trollonaboat i'm not learnt python that deep tho, but i know you can't use 'is' in string comparing operation. for ex :

    foo = str(input("prompt :"))
    if foo is "hello": # 1
    print("hello world")
    elif foo == "hello": # 2
    print("world hello")
    else:
    print("anything else")

    if you input "hello" it will goes the second condition instead of the first one. even if you remove the second condition you will still end up in the else condition instead the 'is' condition.
  • 0
    @wowotek yes. Can't use "is" operator for string comparison.
Add Comment