Q1:
Why doesn’t Python show the objective result instead of what I assumed was binary format? This raises more questions. -----
Q2:
What’s the deal with “… object at 0x7fdb4020fb10>”? Is it connected to the binary system? What questions would I need to ask to illuminate myself?
class tree:
def __init__(self, roots, branches):
self.roots = roots
self.branches = branches
p = tree("this's is just an example", 4)
print(tree(3,4))
print(p)
1: The __str__ method helps define a more human readable output. Or use dataclasses.dataclass to get something similar for free.
2: The hexadecimal number is (generally) the location in memory that the object is stored. Think of it as a way for the interpreter to find the object when it needs it.
Would you write a sophisticated script in Python using class()?
Class() appears to me to be a function within a function (what’s not?). I haven’t discovered a conceptual advantage to using class() instead of dict(). I’ve only noticed that scrips using class() look neat…neat…
@Anno - Based on this and earlier posts, I think you are like a traveller visiting a strange country (Python Land) in a strange continent (Programming) trying to pick up the language by talking to random strangers on the street. My advise: At least consult a phrasebook from time to time
To have a holistic picture of the structure of the Python language in mind, I need to first understand its structure by comparing my existing knowledge with that of Python.