[Python-Dev] Is static typing still optional? (original) (raw)
Eric V. Smith eric at trueblade.com
Sat Jan 6 17:13:49 EST 2018
- Previous message (by thread): [Python-Dev] Summary of Python tracker Issues
- Next message (by thread): [Python-Dev] Is static typing still optional?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 12/10/2017 5:00 PM, Raymond Hettinger wrote:
On Dec 10, 2017, at 1:37 PM, Eric V. Smith <eric at trueblade.com> wrote: On 12/10/2017 4:29 PM, Ivan Levkivskyi wrote: On 10 December 2017 at 22:24, Raymond Hettinger <raymond.hettinger at gmail.com<mailto:raymond.hettinger at gmail.com>> wrote: Without typing (only the first currently works): Point = namedtuple('Point', ['x', 'y', 'z']) # underlying store is a tuple Point = makedataclass('Point', ['x', 'y', 'z']) # underlying store is an instance dict Hm, I think this is a bug in implementation. The second form should also work. Agreed.
I've checked this under bpo-32278.
I have a bunch of pending changes for dataclasses. I'll add this. Eric. Thanks Eric and Ivan. You're both very responsive. I appreciate the enormous efforts you're putting in to getting this right. I suggest two other fix-ups: 1) Let makedataclass() pass through keyword arguments to processclass(), so that this will work: Point = makedataclass('Point', ['x', 'y', 'z'], order=True)
And I've checked this in under bpo-32279.
2) Change the default value for "hash" from "None" to "False". This might take a little effort because there is currently an oddity where setting hash=False causes it to be hashable. I'm pretty sure this wasn't intended ;-)
I haven't looked at this yet.
Eric.
- Previous message (by thread): [Python-Dev] Summary of Python tracker Issues
- Next message (by thread): [Python-Dev] Is static typing still optional?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]