can't add variables to instances of built-in classes

Lawrence D’Oliveiro lawrencedo99 at gmail.com
Tue Jul 19 19:58:52 EDT 2016


On Wednesday, July 20, 2016 at 9:24:57 AM UTC+12, bream... at gmail.com wrote:
>
> On Tuesday, July 19, 2016 at 3:54:12 AM UTC+1, Lawrence D’Oliveiro wrote:
>>
>> On Tuesday, July 19, 2016 at 11:12:52 AM UTC+12, bream... at gmail.com wrote:
>>>
>>> On Monday, July 18, 2016 at 10:48:15 PM UTC+1, Lawrence D’Oliveiro wrote:
>>>>
>>>> <https://github.com/ldo/qahirah>
>>>> When you have lots of read/write properties, I find __slots__ to be a
>>>> good idea.
>>> 
>>> Please explain why, thank you.
>> 
>> I was trying something like
>> 
>>     ctx.dashes = ((0.1, 0.03, 0.03, 0.03), 0)
>> 
>> and wondering why it wasn’t working...
> 
> This makes no sense to me at all.  You appear to be trying to create a
> tuple, which contains a tuple and an integer.  You then say it doesn't
> work, but imply that using __slots__ fixes the problem.  So please explain
> exactly what you were trying to achieve, the exact error you got, with the
> complete traceback, and how using __slots__ fixed the problem.

No traceback. The lines were simply coming out solid, instead of dashed.



More information about the Python-list mailing list