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
-
Grumm18232yThis is a good example of how AI's are working. They don't know shit. They just look-up in the data.
And yes, if the bot was trained with this information : https://peps.python.org/pep-0505/
then it will assume that the information is correct.
It doesn't know that the article was a draft and that it never made into the language. -
davide24242y@Grumm I think it is not that it considered PEP505 to arrive at such answer. First of all, GPT assumes that the user is always right. This means that if the user tells him to use null coalescing with python, he assumes that this feature exists. With the knowledge he has of other languages, he creates this syntax and makes it Python-compatible. The problem is that a newbie might waste a lot of time with this kind of error simply because he puts full trust in the AI and assumes that its answers are always right. Surely this will be improved in the future (perhaps already with GPT4 the output is different) but until then I prefer to consult the old stackoverflow
-
My question is much more: Why did it not make into the language? For me it seems like a nice feature.
-
Grumm18232y@happygimp0 In the link I posted they explain why it was rejected :
Similar behavior to the ?? operator can be achieved with an or expression, however or checks whether its left operand is false-y and not specifically None. This approach is attractive, as it requires fewer changes to the language, but ultimately does not solve the underlying problem correctly.
So it is just based on 'we already have a thing that does it'. -
Grumm18232y@davide uhmm I still think that since it is a language model AI, it doesn't know what is true or false if the AI finds relevant information about the subject.
It just search for already known statements. Like a query send to the API and will make a 'human answer' from the result.
But doing that it will also make 'hypothetical' versions.
Using this for just programming without any thinking is wrong. Even with the next version. -
So I decided to see if python has an operator than can do this.
It does: other = s or "some default value"
Wait what?! Yes, I was shocked too. Explanation in link.
https://stackoverflow.com/questions... -
@Demolishun A true None coalescing operator works for maybe booleans too. But i also totally forgot about the "or" trick (which also has been used in PHP before it got its coalescing operator).
-
SalsaGal2602yAw this seems to have been fixed, I lost a valuable piece to make fun of ChatGPT with
-
Jifuna37262y@SalsaGal Don't worry, just ask chatgpt how to do something what's impossible or obscure it will always explain a non-existenting solution confidently
-
hitko31452y@Demolishun That's a completely different thing. As stated in the linked answer
42 or "something" # returns 42
0 or "something" # returns "something"
None or "something" # returns "something"
False or "something" # returns "something"
"" or "something" # returns "something"
This is not what coalescing operator is. Coalescing operator should behave like
42 ?? "something" # returns 42
0 ?? "something" # returns 0
None ?? "something" # returns "something"
False ?? "something" # returns False
"" ?? "something" # returns "" -
@hitko I use it for null in JS. So the or from Python would work for what I need.
This would be poor mans coalescing operator for Python.
Related Rants
Well... this is to demonstrate that GPT is not smart as most of people think. There is no coalescing operator in python
rant
chatgpt
python
gpt