Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Perl programming is an *empirical* science! -- Larry Wall in <10226@jpl-devvax.JPL.NASA.GOV>


devel / comp.lang.python / Re: Proposal: Syntax for attribute initialisation in __init__ methods

SubjectAuthor
o Re: Proposal: Syntax for attribute initialisation in __init__ methodsdn

1
Re: Proposal: Syntax for attribute initialisation in __init__ methods

<mailman.146.1650160413.20749.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=17901&group=comp.lang.python#17901

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: PythonL...@DancesWithMice.info (dn)
Newsgroups: comp.lang.python
Subject: Re: Proposal: Syntax for attribute initialisation in __init__ methods
Date: Sun, 17 Apr 2022 13:53:07 +1200
Organization: DWM
Lines: 37
Message-ID: <mailman.146.1650160413.20749.python-list@python.org>
References: <CAD+b3HgooPwsBw06+SOtc3S8d9-wFzjzS-CuQSoTeLGikcDvpQ@mail.gmail.com>
<e4dc2443-8ea4-b121-9ba2-0dc0ebc74723@DancesWithMice.info>
<CAD+b3HgmWTbnSX0DT5T7uudOBTOiSFDMhzrOe87RqTU64bc9JQ@mail.gmail.com>
<04553d03-7d71-1022-0a82-39321bd2ec83@DancesWithMice.info>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Trace: news.uni-berlin.de L1zlU+39ILSxqR0j55ibCg/BDHh5TmcrEZ6UETfYRGMg==
Return-Path: <PythonList@DancesWithMice.info>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=danceswithmice.info header.i=@danceswithmice.info
header.b=gze+zlB9; dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.006
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'improvement': 0.05;
'thread': 0.05; '=dn': 0.09; 'from:addr:danceswithmice.info':
0.09; 'from:addr:pythonlist': 0.09; "shouldn't": 0.09; 'though.':
0.09; 'applies': 0.16; 'arguments': 0.16; 'attributes,': 0.16;
'message-id:@DancesWithMice.info': 0.16; 'received:51.254': 0.16;
'received:51.254.211': 0.16; 'received:51.254.211.219': 0.16;
'received:cloud': 0.16; 'received:rangi.cloud': 0.16;
'relatively': 0.16; 'removes': 0.16; 'subject:Syntax': 0.16;
'wrote:': 0.16; 'python': 0.16; "can't": 0.17; 'to:addr:python-
list': 0.20; 'maybe': 0.22; 'code': 0.23; 'discussion': 0.25;
'classes': 0.26; 'so.': 0.26; 'function': 0.27; 'header:User-
Agent:1': 0.30; 'header:Organization:1': 0.31; 'wondering': 0.31;
'think': 0.32; 'question': 0.32; 'concern': 0.32; 'maintaining':
0.32; 'point,': 0.32; 'but': 0.32; "i'm": 0.33; 'subject:for':
0.33; 'same': 0.34; 'header:In-Reply-To:1': 0.34; 'missing': 0.37;
"skip:' 10": 0.37; 'using': 0.37; 'received:192.168': 0.37; 'way':
0.38; 'two': 0.39; 'mentioned': 0.39; 'list': 0.39;
'subject:Proposal': 0.39; 'still': 0.40; 'advantage': 0.40;
'potential': 0.60; 'skip:o 10': 0.61; 'simply': 0.63; 'once':
0.63; 'skip:k 10': 0.64; 'received:51': 0.64; 'received:userid':
0.66; 'order': 0.69; 'subject:skip:i 10': 0.69; 'extra': 0.84;
'discouraged': 0.84; 'criticism': 0.91; 'fall': 0.95
DKIM-Filter: OpenDKIM Filter v2.11.0 vps.rangi.cloud 6CF692FCE
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=danceswithmice.info;
s=staff; t=1650160405;
bh=YNBN0723u0kWIk1ckB4ynwblhoghFqVo+V28yaw/BCs=;
h=Date:Subject:To:References:From:In-Reply-To:From;
b=gze+zlB9C1lMrGrW9Ls2mYEperbbhNDZFbvGdqiPkY5puKrMafptbZGeEx5Hc+3uw
VaZQHai++74FD9ol9rIBV+Ki9PEp1mDxb5ixbEbrq6L3W8E87jTY0KHd+UPKK2OC8J
HcBqQ6lbZyHP1IEXvRQy+8j56fWjl2gzStQiBDasNFZaRnBL5JjvyJMHuZLFZc+uA1
7cc43ZnawQrdJhC6ZZZYGCReTFLVL7dqXa1j238/KvJ8mDsxCRqA7k9EmI3+0VpNj5
+Isji1aP+nj2+Lr8aSyY2ST5HiKVefak4/SjfuHD4D3RtoEFzpTDd+zQiXj1nKwfM1
Po+ki9ixyzzyQ==
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on vps517507.ovh.net
X-Spam-Level:
X-Spam-Status: No, score=-6.9 required=5.0 tests=ALL_TRUSTED,BAYES_00,
DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,NICE_REPLY_A,T_SCC_BODY_TEXT_LINE
autolearn=ham autolearn_force=no version=3.4.0
DKIM-Filter: OpenDKIM Filter v2.11.0 vps.rangi.cloud 532181E37
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=danceswithmice.info;
s=staff; t=1650160404;
bh=YNBN0723u0kWIk1ckB4ynwblhoghFqVo+V28yaw/BCs=;
h=Date:Subject:To:References:From:In-Reply-To:From;
b=crCBPGaha7wJyxjVcw4xlg+8YLhbtiXzx+Yd7nwdxO69rGCzzM60drJq3AaS83QoM
5WvRiKy9/8AfsjSZw9rz5790jaYRCnHsofzH6lnmaR4ngl9b8f8ko8Qftx9iGHhS08
dL7b53kBUiS6tBMRzLjGUzjIAB5aFTuGgDgaheaN75Wwo4zWSyvPjSRJjqGtdF4JC3
kDB4XKf+iZsJYoZwqWAnHEmMMYcsmVW4ETyPD60tQ/+SePuwziigVI7Y81v0zsGdtI
zWJkIRn7LdkjR96juMUpu2FZm5OVFT4ZEgeXYt2BYr1zLv8p6ZqOF+tyGxaGoitJjK
RyE14ito6M8tg==
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.8.0
Content-Language: en-GB
In-Reply-To: <CAD+b3HgmWTbnSX0DT5T7uudOBTOiSFDMhzrOe87RqTU64bc9JQ@mail.gmail.com>
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <https://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: <04553d03-7d71-1022-0a82-39321bd2ec83@DancesWithMice.info>
X-Mailman-Original-References: <CAD+b3HgooPwsBw06+SOtc3S8d9-wFzjzS-CuQSoTeLGikcDvpQ@mail.gmail.com>
<e4dc2443-8ea4-b121-9ba2-0dc0ebc74723@DancesWithMice.info>
<CAD+b3HgmWTbnSX0DT5T7uudOBTOiSFDMhzrOe87RqTU64bc9JQ@mail.gmail.com>
 by: dn - Sun, 17 Apr 2022 01:53 UTC

On 17/04/2022 09.20, Sam Ezeh wrote:
>> Perhaps I'm missing the point, but what functionality or advantage(s)
>> does this give, over data-classes?
>
> One advantage is maintaining control over the __init__ function without
> having to write extra code to do so. In the linked discussion from
> python-ideas, it was mentioned that keyword-only and positional-only
> arguments can't be used with dataclasses [1].
>
>> Maybe Dataclasses are not being used as much as one might hope, but they
>> are relatively new, and many Python-Masters simply carry-on constructing
>> classes the way they have for years...
>
> I think one concern I have is that even if this is useful, it might
> still fall to the same fate.

Don't be discouraged by that - and that thread was not the first of such
discussions! The way Python is being applied is continually changing...

I'm not sure about the criticism of dataclasses though. Starting with
'explicit over implicit', once a parameter-list is more than two or
three long, shouldn't we be using 'labels' in order to avoid (potential)
confusion, ie keyword-parameters?

This removes the order/sequence of arguments from the list of potential
problems/gotchas one can fall into!

In which case, I'm wondering just how often the criticism applies 'in
real life'?

So, now the question becomes: what are the cases/examples which
require/desire improvement over the 'traditional' __init__ of
attributes, and facilities offered through dataclasses?
--
Regards,
=dn

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor