[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-22 Thread Steven D'Aprano
On Tue, Oct 22, 2019 at 11:39:59AM -0700, Mike Miller wrote: > > On 2019-10-18 10:23, Ricky Teachey wrote: > >but i'm -0 because i am very concerned it will not be obvious to new > >learners, without constantly looking it up, whether adding two mappings > >together would either: > > The big

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-22 Thread Guido van Rossum
I'm not crazy about advertising APIs this way ("did you mean ..."), and even if we would eventually decide to do this, I'm not sure that dict+dict is the place to start. (Okay, we already started, with "print x" saying "Did you mean print(x)?" -- but that shows how rare this should be IMO.)

[Python-ideas] Re: [Python-Dev] 4 first-time contributions that need core review.

2019-10-22 Thread Dong-hee Na
Wrong reply sorry. ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at

[Python-ideas] Re: [Python-Dev] 4 first-time contributions that need core review.

2019-10-22 Thread Dong-hee Na
> https://github.com/python/cpython/pull/16680: bpo-38419: fix > "check-c-globals" path This PR was merged by Carol today :) 2019년 10월 23일 (수) 오전 3:53, Brandt Bucher 님이 작성: > > Hi all. There are a few *very simple* PRs from first-time contributors that > have been sitting un-core-reviewed for

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-22 Thread Andrew Barnert via Python-ideas
On Oct 22, 2019, at 17:47, Chris Angelico wrote: > > Currently, the CPython optimizer can recognize constructs like "if x > in [1,2,3,4]" or "for x in [1,2,3,4]" and use a literal tuple instead > of building a list. Recognizing the splitting of a string as another > equivalent literal could be

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-22 Thread Todd
On Tue, Oct 22, 2019 at 7:57 PM Steven D'Aprano wrote: > On Tue, Oct 22, 2019 at 04:11:45PM -0400, Todd wrote: > > On Tue, Oct 22, 2019 at 3:54 PM Steve Jorgensen > wrote: > > > > > See > > > > https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#The_%_Notation > > > for what Ruby

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-22 Thread Chris Angelico
On Wed, Oct 23, 2019 at 10:59 AM Steven D'Aprano wrote: > > For the example you gave, besides saving a few characters I don't see the > > advantage over the existing way we have to do that: > > > > 'one two three'.split() > > One of the reasons why Python is "slow" is that lots of things that can

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-22 Thread Steven D'Aprano
On Tue, Oct 22, 2019 at 04:11:45PM -0400, Todd wrote: > On Tue, Oct 22, 2019 at 3:54 PM Steve Jorgensen wrote: > > > See > > https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#The_%_Notation > > for what Ruby offers. > > > > For me, the arrays are the most useful aspect. > > > >

[Python-ideas] Re: Ability to set precedence of classdict (returned from __prepare__) for a metaclass type

2019-10-22 Thread Ethan Furman
On 10/22/2019 03:13 PM, Steve Jorgensen wrote: Ethan Furman wrote: Experimenting is good! However, you'll want to either build your own metaclass and/or prepared dict, or do some work on your __new__/__init__ methods for building enum members. Currently, you are reassigning _value_ in

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-22 Thread Steve Jorgensen
Andrew Barnert wrote: > On Oct 22, 2019, at 15:06, Steve Jorgensen ste...@stevej.name wrote: > > Actually, in Ruby, the surrounding character pair can > > be pretty much anything `, and in practice, curly braces are often used. > This seems like a prime example of “Ruby is Perl done right, Python

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-22 Thread Andrew Barnert via Python-ideas
On Oct 22, 2019, at 15:06, Steve Jorgensen wrote: > > Actually, in Ruby, the surrounding character pair can be pretty much anything > `, and in practice, curly braces are often used. This seems like a prime example of “Ruby is Perl done right, Python is not doing Perl.”

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-22 Thread Andrew Barnert via Python-ideas
On Oct 22, 2019, at 11:39, Mike Miller wrote: > > Had an idea, why not choose the more accurate syntax: |, |= after all? Then, > to help newcomers and forgetful pros a custom error message is implemented > for +, +=. In pseudo C/Python, something like this: > >class dict: > >

[Python-ideas] Re: Ability to set precedence of classdict (returned from __prepare__) for a metaclass type

2019-10-22 Thread Steve Jorgensen
Ethan Furman wrote: > > Experimenting is good! However, you'll want to either build your own > > metaclass > and/or prepared dict, or do some work on your __new__/__init__ > methods for building enum members. Currently, you are reassigning _value_ in > __init__, which leaves some internal

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-22 Thread Steve Jorgensen
Todd wrote: > On Tue, Oct 22, 2019 at 3:54 PM Steve Jorgensen ste...@stevej.name wrote: > > See > I am not seeing the advantage of this. Can you provide some specific > examples that you think would benefit from this syntax? > For the example you gave, besides saving a few characters I don't see

[Python-ideas] Re: Ability to set precedence of classdict (returned from __prepare__) for a metaclass type

2019-10-22 Thread Ethan Furman
On 10/21/2019 10:33 PM, Steve Jorgensen wrote: class ChoiceEnum(Enum): def __init__(self, src=None, label=None): super().__init__() if isinstance(src, Label): value = None label = str(src) else:

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-22 Thread Todd
On Tue, Oct 22, 2019 at 3:54 PM Steve Jorgensen wrote: > See > https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#The_%_Notation > for what Ruby offers. > > For me, the arrays are the most useful aspect. > > %w{one two three} > => ["one", "two", "three"] > > I did a search,

[Python-ideas] Re: Percent notation for array and string literals, similar to Perl, Ruby

2019-10-22 Thread David Mertz
"one two three".split() On Tue, Oct 22, 2019, 3:56 PM Steve Jorgensen wrote: > See > https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#The_%_Notation > for what Ruby offers. > > For me, the arrays are the most useful aspect. > > %w{one two three} > => ["one", "two",

[Python-ideas] Percent notation for array and string literals, similar to Perl, Ruby

2019-10-22 Thread Steve Jorgensen
See https://en.wikibooks.org/wiki/Ruby_Programming/Syntax/Literals#The_%_Notation for what Ruby offers. For me, the arrays are the most useful aspect. %w{one two three} => ["one", "two", "three"] I did a search, and I don't see that this has been suggested before, but I might have

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-22 Thread Neil Girdhar
I really like this idea. Once you've already decided to raise an exception, does it really cost much to try to raise a more helpful one? And helpful exception messages make programming a lot less painful, and a lot more of a joy. On Tue, Oct 22, 2019 at 2:43 PM Mike Miller wrote: > > On

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-22 Thread Mike Miller
On 2019-10-18 10:23, Ricky Teachey wrote: but i'm -0 because i am very concerned it will not be obvious to new learners, without constantly looking it up, whether adding two mappings together would either: The big trade off I'm gathering from this mega-thread is that the |, |= operators are

[Python-ideas] Re: PEP 584: Add + and += operators to the built-in dict class.

2019-10-22 Thread Jan Greis
On 22/10/2019 06:43, Richard Musil wrote: It is not a "concatenation" though, because you lost {"key1": "val1"} in the process. The concatenation is not _just_ "writing something after something", you can do it with anything, but the actual operation, producing the result. My point is that

[Python-ideas] Re: RFC: PEP xxx: Python Compatibility Version

2019-10-22 Thread Antoine Pitrou
Hi, Just bear in mind that I have read only a couple sentences in the PEP. But as soon as you propose to offer only "partial compatibility" with a previous version, then I think it's worse than useless. You are introducing an additional Python version, i.e. "3.9 bended towards 3.8 partial

[Python-ideas] Re: Extending @ syntax to allow expressions

2019-10-22 Thread Serhiy Storchaka
22.10.19 06:41, Andrew Barnert via Python-ideas пише: 2: I'm not sure what this would to to uses of "@" as an operator, as has been suggested various times for various laudable reasons; remember that an @decorator or other function definition is just another statement, and arbitrary