Re: [Python-Dev] Is static typing still optional?
On 12/10/2017 5:00 PM, Raymond Hettinger wrote: On Dec 10, 2017, at 1:37 PM, Eric V. Smithwrote: On 12/10/2017 4:29 PM, Ivan Levkivskyi wrote: On 10 December 2017 at 22:24, Raymond Hettinger > wrote: Without typing (only the first currently works): Point = namedtuple('Point', ['x', 'y', 'z']) # underlying store is a tuple Point = make_dataclass('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 make_dataclass() pass through keyword arguments to _process_class(), so that this will work: Point = make_dataclass('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. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Whatever happened to 'nonlocal x = y'?
https://github.com/python/peps/commit/2d2ac2d2b66d4e37e8b930f5963735616bddbbe8 On Sat, Jan 6, 2018, at 08:56, Barry Warsaw wrote: > On Jan 6, 2018, at 11:43, Guido van Rossumwrote: > > > > Maybe we should not delete them outright but add something like "(UPDATE: > > during later discussions it was decided that this feature shouldn't be > > added.)" > > +1 > > -Barry > > ___ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > https://mail.python.org/mailman/options/python-dev/benjamin%40python.org > Email had 1 attachment: > + signature.asc > 1k (application/pgp-signature) ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Whatever happened to 'nonlocal x = y'?
On Fri, Jan 5, 2018, at 14:07, Guido van Rossum wrote: > Yeah, but I've changed my mind on this -- I think it's needless added > complexity that helps save one line of code in very few use cases. And you > don't really think the PEP endorses `nonlocal foo += 1` do you? The PEP itself is very clear about supporting "augmented assignment", even defining the grammar differently for this case (such that you can't do it with multiple names in a single statement). The grammar shown also supports "nonlocal foo = bar = baz", though the text doesn't mention this form. ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Whatever happened to 'nonlocal x = y'?
On Jan 6, 2018, at 11:43, Guido van Rossumwrote: > > Maybe we should not delete them outright but add something like "(UPDATE: > during later discussions it was decided that this feature shouldn't be > added.)" +1 -Barry signature.asc Description: Message signed with OpenPGP ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Whatever happened to 'nonlocal x = y'?
Maybe we should not delete them outright but add something like "(UPDATE: during later discussions it was decided that this feature shouldn't be added.)" On Fri, Jan 5, 2018 at 10:52 PM, Benjamin Petersonwrote: > > > On Fri, Jan 5, 2018, at 01:57, Nathaniel Smith wrote: > > Was this just an oversight, or did it get rejected at some point and > > no-one remembered to update that PEP? > > There was an implementation https://bugs.python.org/issue4199. But > several years ago, we again reached the conclusion that the feature > shouldn't be added. > > Normally, I think final PEPs shouldn't be updated. But maybe in this case, > it's worth deleting those lines to avoid future confusion. > ___ > Python-Dev mailing list > Python-Dev@python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ > guido%40python.org > -- --Guido van Rossum (python.org/~guido) ___ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com