#๐ class questions
13 messages ยท Page 1 of 1 (latest)
@green wedge
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
class questions
Yes, str() calls the __str__ dunder. Creating instances of int the way you're describing is a unique thing based on how the language was designed. These creations are known as "literals"
!e
5 = 10
:x: Your 3.13 eval job has completed with return code 1.
001 | File [35m"/home/main.py"[0m, line [35m1[0m
002 | [1;31m5[0m = 10
003 | [1;31m^[0m
004 | [1;35mSyntaxError[0m: [35mcannot assign to literal here. Maybe you meant '==' instead of '='?[0m
"cannot assign to literal"
It calls it in the class you're converting. It's basically 5.__str__()
We can still instantiate with the literal class name. int() gives you 0
Python is written in C. I don't personally know how they implemented literals
Yeah for sure, that's part of the interpreter
You don't really need to understand it unless you're interested in programming languages in general
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.