On Tue, 09 Jan 2018 16:14:27 +0200, Frank Millman wrote:
> Maybe I was not clear. The Context instance is passed as an argument to
> many methods. The methods can access the attributes of the instance. The
> instance has no methods of its own.
Ah, I see, I misunderstood.
[...]
>> Alternatively,
On 01/09/2018 07:30 AM, Steven D'Aprano wrote:
> If you have a class with only data, and you access the attributes via the
> instance's __dict__, why not use an ordinary dict?
Or even subclass dict.
class MyClass(dict):
VAR = 5
m = MyClass()
m['newvar'] = "Something"
I do this and wrap thing
"Steven D'Aprano" wrote in message news:[email protected]...
On Tue, 09 Jan 2018 11:28:03 +0200, Frank Millman wrote:
> I have a class call Context containing only data, not methods. Instances
> are passed around a lot in my application, with various methods
> accessing various
On Tue, 09 Jan 2018 11:28:03 +0200, Frank Millman wrote:
> I have a class call Context containing only data, not methods. Instances
> are passed around a lot in my application, with various methods
> accessing various attributes.
That contradicts itself... your Context class has data, but no meth
"Frank Millman" wrote in message news:[email protected]...
"Peter Otten" wrote in message news:[email protected]...
Frank Millman wrote:
> Hi all
>
> I have read that one should not call dunder methods in application code.
>
> Does the same apply to dunder varia
"Peter Otten" wrote in message news:[email protected]...
Frank Millman wrote:
> Hi all
>
> I have read that one should not call dunder methods in application code.
>
> Does the same apply to dunder variables? I am thinking of the instance
> attribute __dict__, which allows acces
On Tue, 09 Jan 2018 09:55:49 +0200, Frank Millman wrote:
> Hi all
>
> I have read that one should not call dunder methods in application code.
"Should not" rather than "must not", but that's correct. In general,
calling a dunder method directly is *not* the same as the operation you
probably w
Frank Millman wrote:
> Hi all
>
> I have read that one should not call dunder methods in application code.
>
> Does the same apply to dunder variables? I am thinking of the instance
> attribute __dict__, which allows access to the contents of the instance.
>
> I only want to read from __dict__,