Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why can I derive a class from built-in types (e.g. lists or files)?

0
Posted

Why can I derive a class from built-in types (e.g. lists or files)?

0

This is caused by the relatively late addition of (user-defined) classes to the language — the implementation framework doesn’t easily allow it. See the answer to question 4.2 for a work-around. This may be fixed in the (distant) future. —————————————————————————- 6.7. Why must ‘self’ be declared and used explicitly in method definitions and calls? By asking this question you reveal your C++ background. 🙂 When I added classes, this was (again) the simplest way of implementing methods without too many changes to the interpreter. I borrowed the idea from Modula-3. It turns out to be very useful, for a variety of reasons. First, it makes it more obvious that you are using a method or instance attribute instead of a local variable. Reading “self.x” or “self.meth()” makes it absolutely clear that an instance variable or method is used even if you don’t know the class definition by heart. In C++, you can sort of tell by the lack of a local

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123