Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
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..
-
@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... 🤔 -
wowotek58276y@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.
Related Rants
-
retard8Shower thought: What if clients and bosses are using devRant to spy on us
-
Cyanite29At what point can you say you are a programmer of a language? Is there an exact amount of lines of code carved...
-
Floydimus11I have a built in NLU and NLP feature for English language within me. And when I learn a new language, I am b...
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?
joke/meme
shower thought