Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111659

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

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: can't add variables to instances of built-in classes
Date Wed, 20 Jul 2016 16:19:28 +1000
Lines 42
Message-ID <mailman.1.1468995572.22221.python-list@python.org> (permalink)
References <4f796d95-0e87-4610-a0a8-1eff07c60ace@googlegroups.com> <nmfqrg$ea7$1@ger.gmane.org> <mailman.63.1468755660.2307.python-list@python.org> <b24bede0-be29-4c45-856e-90e6a63c99d0@googlegroups.com> <578b9e62$0$22141$c3e8da3$5496439d@news.astraweb.com> <3e934f83-2076-407d-b85b-686ecdec6ff8@googlegroups.com> <nmi127$r0e$1@ger.gmane.org> <mailman.70.1468827536.2307.python-list@python.org> <2bc29306-ac90-4424-84c2-64be494c5a75@googlegroups.com> <bff64f31-d618-4d47-a81b-aa817db8c456@googlegroups.com> <230d1aff-b1a3-4f16-b9a6-b5d9fd07e4b4@googlegroups.com> <62dd86d4-74f7-4e97-a29c-7e45aced77d9@googlegroups.com> <f988e9a1-beba-41f3-bd11-8ed4c7a69a81@googlegroups.com> <CAPTjJmrup=D9pP5buOytY7x1zQYC6Nh-R=WkaXcJBAfbD+_JJA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace news.uni-berlin.de 5x9L0cFCrbwEhtOdikbHJgkJRnSbjtecQeKzeRteqbfQ==
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'fixes': 0.05; 'imply': 0.07; 'wednesday,': 0.07; 'cc:addr:python-list': 0.09; 'tuple': 0.09; 'url:github': 0.09; 'wed,': 0.15; '2016': 0.16; '__slots__': 0.16; 'exactly?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'how,': 0.16; 'integer.': 0.16; 'properties,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'traceback.': 0.16; 'tuple,': 0.16; 'why,': 0.16; 'wrote:': 0.16; 'debugging': 0.18; '>>>': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'work,': 0.21; 'lawrence': 0.22; 'trying': 0.22; 'am,': 0.23; 'header:In-Reply-To:1': 0.24; 'all.': 0.24; 'sort': 0.25; 'wondering': 0.25; "doesn't": 0.26; 'appear': 0.26; 'sense': 0.26; 'error': 0.27; 'message-id:@mail.gmail.com': 0.27; 'that.': 0.30; "we're": 0.30; 'programmers': 0.30; "i'd": 0.31; 'fixed': 0.31; 'problem': 0.33; "i'll": 0.33; 'received:google.com': 0.35; 'something': 0.35; 'problem.': 0.35; 'but': 0.36; 'instead': 0.36; 'lines': 0.36; 'monday,': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'say': 0.37; 'thank': 0.38; 'why': 0.39; 'subject:-': 0.39; 'future': 0.60; 'email addr:gmail.com': 0.62; 'complete': 0.63; 'you.': 0.64; '20,': 0.66; '>>>>>': 0.66; 'jul': 0.72; 'sounds': 0.76; 'chrisa': 0.84; 'cult': 0.84; 'wasn\xe2\x80\x99t': 0.84; 'to:none': 0.91; 'subject:add': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:cc :content-transfer-encoding; bh=tuKRWzf0SditOjWK6iX6/UlKSdG7keW3dVyg2PsjH7M=; b=A+JQjxFHSbvG6Jz5UvTVujsRFHGoJxlzPZ6Xrd/vNq+DMCaMiuqQ4Oqblg+iX+B4we fstwE6NTOIiLR16jt6XMMBY4QRZ0OYc56b0eW4z4DwnBIScJIMpaAGKWc/ZaTpw2oJkw RPl8SucB1a93S6Egf0U5UcXx71XAfZZPF64gkyxJRRugiSQVv9Zr4+GDAd7UOCV+WJ9b 8cfONZjrpKxa0tvFe5aPADOLEI7tfmwD7mbcR39dmm6vFfqZKdymsHOb4i8sJJxwhvCI 9gtPmiMMkCbCli3s3dw53Txo2v6jNGJiCzUMGvrVOIak+qXHzTvZm8r6NY6hM5VBhMdA E2rg==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:cc:content-transfer-encoding; bh=tuKRWzf0SditOjWK6iX6/UlKSdG7keW3dVyg2PsjH7M=; b=HC7tMRipcCHytlOsT+V0rEd/b2RLf/A47UNGfYp8vBU8Kkmz9yAYkOZrRydVLcQsz9 ErHcv5WU4AVd09k74UtnAweHcb3c/VJl99/dF6ntjcVkuxYr9es29qVPbAukuJu7ij0U tpbPtkq8vQIyoyjQn2CeBnntl+C3qfzvUTTmpENn6rvl9K8ELvG2XNQWiS/2SqaBHuFi t//Yyp6SJm474Hy+WNTpMl061mgJPAlCxOLhcXFP9oQEbpdCasTtM0mONMwaGEgDscJN bhfCFHfFvp4ftrsEhcZrYN11In65IxVq8i4oNA9mEof+WBTladr1HIIZdgj4saMNvJMy 5GiQ==
X-Gm-Message-State ALyK8tJ71w4hISfMfQrwX5Bs5XwolTlVNBQi+oIOZZwOo0UxJnADfi6NArmL8AO8PYVvMHWPj58bu26/limy6w==
X-Received by 10.28.41.195 with SMTP id p186mr9704638wmp.41.1468995569893; Tue, 19 Jul 2016 23:19:29 -0700 (PDT)
In-Reply-To <f988e9a1-beba-41f3-bd11-8ed4c7a69a81@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.22
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAPTjJmrup=D9pP5buOytY7x1zQYC6Nh-R=WkaXcJBAfbD+_JJA@mail.gmail.com>
X-Mailman-Original-References <4f796d95-0e87-4610-a0a8-1eff07c60ace@googlegroups.com> <nmfqrg$ea7$1@ger.gmane.org> <mailman.63.1468755660.2307.python-list@python.org> <b24bede0-be29-4c45-856e-90e6a63c99d0@googlegroups.com> <578b9e62$0$22141$c3e8da3$5496439d@news.astraweb.com> <3e934f83-2076-407d-b85b-686ecdec6ff8@googlegroups.com> <nmi127$r0e$1@ger.gmane.org> <mailman.70.1468827536.2307.python-list@python.org> <2bc29306-ac90-4424-84c2-64be494c5a75@googlegroups.com> <bff64f31-d618-4d47-a81b-aa817db8c456@googlegroups.com> <230d1aff-b1a3-4f16-b9a6-b5d9fd07e4b4@googlegroups.com> <62dd86d4-74f7-4e97-a29c-7e45aced77d9@googlegroups.com> <f988e9a1-beba-41f3-bd11-8ed4c7a69a81@googlegroups.com>
Xref csiph.com comp.lang.python:111659

Show key headers only | View raw


On Wed, Jul 20, 2016 at 9:58 AM, Lawrence D’Oliveiro
<lawrencedo99@gmail.com> wrote:
> On Wednesday, July 20, 2016 at 9:24:57 AM UTC+12, bream...@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...@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.

And __slots__ fixed the problem how, exactly? This sounds like the
sort of cargo cult debugging that I'd expect of PHP programmers ("I
put addslashes around everything and now it works, so in future I'll
use addslashes everywhere"), but around here, we're better than that.

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

can't add variables to instances of built-in classes Kent Tong <kent.tong.mo@gmail.com> - 2016-07-17 03:57 -0700
  Re: can't add variables to instances of built-in classes Peter Otten <__peter__@web.de> - 2016-07-17 13:40 +0200
    Re: can't add variables to instances of built-in classes Wilson Ong <wilsonokw@gmail.com> - 2016-07-17 04:50 -0700
      Re: can't add variables to instances of built-in classes Chris Angelico <rosuav@gmail.com> - 2016-07-17 22:02 +1000
      Re: can't add variables to instances of built-in classes Steven D'Aprano <steve@pearwood.info> - 2016-07-18 01:04 +1000
        Re: can't add variables to instances of built-in classes Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-17 20:00 -0700
          Re: can't add variables to instances of built-in classes Peter Otten <__peter__@web.de> - 2016-07-18 09:38 +0200
            Re: can't add variables to instances of built-in classes Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-18 14:48 -0700
              Re: can't add variables to instances of built-in classes breamoreboy@gmail.com - 2016-07-18 16:12 -0700
                Re: can't add variables to instances of built-in classes Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-18 19:53 -0700
                Re: can't add variables to instances of built-in classes breamoreboy@gmail.com - 2016-07-19 14:24 -0700
                Re: can't add variables to instances of built-in classes Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-19 16:58 -0700
                Re: can't add variables to instances of built-in classes Chris Angelico <rosuav@gmail.com> - 2016-07-20 16:19 +1000
                Re: can't add variables to instances of built-in classes Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-19 23:45 -0700
                Re: can't add variables to instances of built-in classes Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2016-07-20 17:22 +1000
                Re: can't add variables to instances of built-in classes Peter Otten <__peter__@web.de> - 2016-07-20 09:26 +0200
                Re: can't add variables to instances of built-in classes Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-20 01:50 -0700
                Re: can't add variables to instances of built-in classes Peter Otten <__peter__@web.de> - 2016-07-20 11:15 +0200
                Re: can't add variables to instances of built-in classes Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-20 15:11 -0700
                Re: can't add variables to instances of built-in classes Chris Angelico <rosuav@gmail.com> - 2016-07-21 12:29 +1000
                Re: can't add variables to instances of built-in classes Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-08-03 19:34 -0700
                Re: can't add variables to instances of built-in classes Chris Angelico <rosuav@gmail.com> - 2016-08-04 13:00 +1000
                Re: can't add variables to instances of built-in classes Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-08-04 16:57 -0700
                Re: can't add variables to instances of built-in classes Steven D'Aprano <steve@pearwood.info> - 2016-07-21 12:48 +1000
                Re: can't add variables to instances of built-in classes Steven D'Aprano <steve@pearwood.info> - 2016-07-20 22:10 +1000
                Re: can't add variables to instances of built-in classes Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-20 14:48 -0700
                Re: can't add variables to instances of built-in classes breamoreboy@gmail.com - 2016-07-20 18:04 -0700
                Re: can't add variables to instances of built-in classes Peter Otten <__peter__@web.de> - 2016-07-21 08:59 +0200
              Re: can't add variables to instances of built-in classes Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-07-20 02:10 -0700
      Re: can't add variables to instances of built-in classes Ethan Furman <ethan@stoneleaf.us> - 2016-07-18 06:10 -0700
  Re: can't add variables to instances of built-in classes Kent Tong <kent.tong.mo@gmail.com> - 2016-07-17 04:53 -0700

csiph-web